Advertisement
teslariu

biblio

Nov 4th, 2021
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. Script que muestra un cuenta regresiva de 10 a 0, mostrando los números
  6. segundo a segundo
  7. Ayuda: usar la biblioteca time y la función sleep
  8. Ej: time.sleep(3)
  9.  
  10. import time
  11.  
  12. i = 10
  13. for i in range(10,-1,-1):
  14.     print(i)
  15.     time.sleep(1)
  16.    
  17. """
  18. # escribir un script que tenga un menu y permita generar nros aleatorios
  19. # entre 1 y 6 como si fuera un dado
  20. # Menu
  21. # 1. Tirar dado
  22. # 2. Salir
  23. # ayuda: usar random y la función randint
  24.  
  25. import random
  26.  
  27. while True:
  28.     print("\nMenu")
  29.     print("1 tirar dado ")
  30.     print("2 salir")
  31.     opcion = input("ingrese una opcion: ")
  32.    
  33.     if opcion == "1":
  34.         print(random.randint(1, 6))
  35.    
  36.     elif opcion == "2":
  37.         print("gracias por usar este programa")
  38.         break
  39.    
  40.     else:
  41.         print("error ")
  42.  
  43.  
  44.    
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement