Created
March 25, 2013 23:02
-
-
Save felipecabargas/5241675 to your computer and use it in GitHub Desktop.
Respuestas problemas 2 y 3 - Primera Actividad en Clases curso de Programación (IWI-131) UTFSM Stgo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minutos = float(raw_input("Minutos hablados: ")) | |
horario = raw_input("Horario: ") | |
if horario=="NOCHE": | |
subtotal = int(minutos*7) | |
else: | |
subtotal = int(minutos*10) | |
if subtotal > 1500: | |
descuento = int(subtotal/10) | |
total = int(subtotal - descuento) | |
print "Usted debera pagar", subtotal, "pesos" | |
print "Con la promocion queda en", total, "pesos" | |
else: | |
print "Usted debera pagar", subtotal, "pesos" | |
print "No hay descuentos" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print "Jugador X" | |
#Inputs para cartas del jugador X | |
carta1x = int(raw_input("Carta 1: ")) | |
carta2x = int(raw_input("Carta 2: ")) | |
print "Jugador Y" | |
#Inputs para cartas del jugador Y | |
carta1y = int(raw_input("Carta 1: ")) | |
carta2y = int(raw_input("Carta 2: ")) | |
#Comparaciones para cada jugador | |
parx = (carta1x == carta2x) | |
pary = (carta1y == carta2y) | |
difx = abs(carta1x - carta2x) | |
dify = abs(carta1y - carta2y) | |
if parx != pary and parx == True: | |
print "Gana X" | |
elif parx != pary and pary == True: | |
print "Gana Y" | |
else: | |
if dify > difx: | |
print "Gana X" | |
elif difx > dify: | |
print "Gana Y" | |
else: | |
print "Empate" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment