## saludo.py print(" Como se llama ?") nombre = input() print("Un placer saludarle", nombre) ############### ## pesetas.py cantidad = int(input("Digame una cantidad en pesetas: ")) print(cantidad, "pesetas son", cantidad / 166.386, "euros") ## If numero = int(input("Escriba un numero positivo: ")) if numero < 0: print("Parece que no me has entendido") print("! Le he dicho que escriba un numero positivo!") print("Ha escrito el numero", numero) print("Adios") ####### ## votar.py edad = int(input("Cuantos anhos tiene? ")) if edad < 18: print("Es usted menor de edad. No puede votar.") else: print("Es usted mayor de edad. Puede votar.") print("¡Hasta la proxima!") ######### ### regalos_boda(1).py n = float(input("Dime tu presupuesto: ")) if n >= 30000: print("vehiculo") if 600 <= n < 30000 : print("vajilla") if 400 <= n < 600 : print("TV") if 1 <= n < 400: print("abrebotellas") if n < 1: print("no voy a la boda") ##### ### regalos_boda(2).py n = float(input(" Dime tu presupuesto: ")) if n >= 30000: print("vehiculo") else: if n >= 600: print("vajilla") else: if n >= 400: print("TV") else: if n >= 1: print("abrebotellas") else: print("no voy a la boda") ########### ### regalos_boda(3).py print ('Programa Comprar regalo boda') print (' Introduzca el presupuesto.') a = float(input('a = ')) if a >= 30000: print("Regalo un vehiculo") elif a >= 600: print("Regalo una vajilla") elif a >= 400: print("Regalo un TV") elif a >= 1: print("Regalo un abrebotellas") else: print("Lo siento, no puedo ir a tu boda") ############### #### bis_1.py print('Escriba un anho:') a = int(input()) if a % 400 == 0: print('bisiesto') if a %100 == 0: print('normal') if a % 4 == 0: print('bisiesto') else: print('normal') ############### #### bis_2.py print('Escriba un anho:') a = int(input()) if a % 400 == 0: print('bisiesto') elif a % 100 == 0: print('normal') elif a % 4 == 0: print ('bisiesto') else: print('normal') ############### #### bis_3.py print('Escriba un anho:') a = int(input()) if a %400 == 0 or not a % 100 == 0 and a % 4 == 0: print('bisiesto') else: print('normal') ############### #BUCLES 1 i = 1 while i <= 50: print(i) i = 3*i + 1 print("Final") ############### #BUCLES 2 i = 1 while i <= 10: print(i, "", end="") ############### #BUCLES 3 a, b = 0, 1 while b < 1000: print(b, end = ',') a, b = b, a + b ############### #BUCLES 4 lista=[1, 2, 'a', True] for x in lista: print(x) print('------') for i in range(4): print(lista[i]) ############### #BUCLES 5 tupla=(1, 2, 'a', True) for x in tupla: print(x) print('------') for i in range(4): print(tupla[i]) ############### #BUCLES 6 cadena='12aT' for x in cadena: print(x) print('------') for i in range(4): print(cadena[i]) ############### #BUCLES 7 misuma = 0 for x in range(7,10): misuma += 1 print(misuma) ############### #BUCLES 8 misuma = 0 for x in range(5,11,2): misuma += x print(misuma) ############### ###### dardo_1.py total = 0 for i in range(10): p = int(input('Puntos: ')) total += p print ('TOTAL:',total) ############### ###### dardo_2.py total = 0 for i in range(10): p = int(input('Puntos: ')) if p >= 50: total += p print ('TOTAL:',total) ############### ###### dardo_3.py total = 0 for i in range(10): p = int(input('Puntos: ')) if p < 50: continue total += p print('TOTAL:',total) ############### ###### dardo_4.py total = 0; total1 = 0 for i in range(10): p = int(input('Puntos: ')) if p < 1: total1 = -1 total += p if total1 < 0: print('TOTAL:', total1) else: print('TOTAL:', total) ############### ###### dardo_5.py total = 0; i = 0 while i < 10: p = int(input('Puntos: ')) if p < 1: total = -1 i = 11 total += p i += 1 print('TOTAL:', total) ############### ###### dardo_6.py total = 0 for i in range(10): p = int(input('Puntos: ')) if p < 1: total = -1 break total += p print('TOTAL:', total)