Advertisement
teslariu

imports

Sep 6th, 2022
640
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. >>> import time
  6. >>> time.asctime()
  7. 'Tue Sep  6 15:46:16 2022'
  8. >>> time.sleep(5)
  9. >>> while True:
  10. ...     time.sleep(10)
  11. ...     break
  12. ...
  13. >>>
  14.  
  15. """
  16. # Hacer un script que implemente una cuenta regresiva desde 10 a 1 y
  17. # luego diga BOOM
  18. """
  19. >>>10
  20. >>>9
  21. ....
  22.  
  23. >>>1
  24. >>>BOOOM
  25. """
  26. import time
  27.  
  28. for i in range(10,0,-1):
  29.     print(i)
  30.     time.sleep(1)
  31. print("BOOOM")
  32.  
  33. #### Script que juega a la adivinar un nùmero del 1 al 100. Solamente
  34. #### cuenta con 7 posibilidades. El programa debe responder
  35. # acerto
  36. # elija un nro mayor
  37. # elija un nro menor
  38. import random
  39.  
  40. numero = random.randint(1,100)
  41.  
  42. for i in range(7):
  43.     n = int(input("Adivine el nro (de 0 a 100): "))
  44.    
  45.     if n == numero:
  46.         print("Acerto, felicitaciones...")
  47.         break
  48.        
  49.     elif n > numero:
  50.         print("Elija un nro menor")
  51.        
  52.     else:
  53.         print("Elija un nro mayor")
  54.        
  55.     print(f"Le quedan {6-i} opciones")
  56.  
  57. #### DESAFIO: implementar el juego de piedra, papel o tijera humano vs compu
  58. ## al mejor de un nro ingresado previamente
  59. # >>> Rondas ?
  60. # >>> 5
  61. # Compu 1 - Humano 0
  62. #....
  63.  
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement