Advertisement
diegokr

Codificación - Combinados Ejercicio 6

Oct 31st, 2019
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. #Ejercicio 6 - Combinados 2019
  2. #Autor: Diego Krauthamer
  3.  
  4. #Declaración de variables
  5. cantcan=0
  6. tiempotot=0
  7. nombre=""
  8. duracion=-1
  9. continuar="S"
  10.  
  11. #Cuerpo principal del programa
  12. while continuar=="S":
  13.  
  14.    #Inicializacion de variables
  15.    nombre=""
  16.    duracion=-1
  17.    continuar="Z"
  18.  
  19.    #Ingreso y validacion de nombre la cancion
  20.    while nombre=="":
  21.      print("Ingrese nombre")
  22.      nombre=input()
  23.      
  24.      #Mensaje de error
  25.      if nombre=="":
  26.         print("ERROR - Ingrese nombre correcto")
  27.  
  28.    #Ingreso y validacion de la duracion de la cantalla
  29.    while duracion <=0:
  30.      print("Ingrese duracion en minutos")
  31.      duracion=int(input())
  32.      
  33.      #Mensaje de error
  34.      if duracion <=0:
  35.        print("ERROR - Ingrese duracion correcta")
  36.  
  37.    cantcan=cantcan+1 #Incremento contador de canciones
  38.    tiempotot=tiempotot+duracion #Acumulo la duracion de cancion
  39.  
  40.    #Pregunto al usuario si desea continuar
  41.    while continuar!="S" and continuar !="N":
  42.      print("Desea continuar S/N")
  43.      continuar=input()
  44.      
  45.      if continuar!="S" and continuar !="N":
  46.        print("Error - ingrese S o N")
  47.  
  48. #Salida por pantalla
  49. print("Cantidad de canciones:",cantcan)
  50. print("Tiempo Total:",tiempotot)
  51. print("Tiempo Total en horas:",float(tiempotot/60))
  52. print("Promedio:",float(tiempotot/cantcan))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement