Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. #example of condition controlled loop in python
  2. import random
  3. import time
  4. pokemon = 0
  5. def main():
  6.     x = True #boolean data type
  7.     while x == True:
  8.         print("POKEMON ENCOUNTERS:(PICKONE TO CATCH) pidgey,mew")
  9.         catch = input("which pokemon do you want to catch").lower()
  10.         if catch == "pidgey":
  11.             time.sleep(2)
  12.             b = random.randint(0,1)
  13.             if b == 1:
  14.                 print("you caught pidgey")
  15.                 global pokemon
  16.                 pokemon = pokemon + 1
  17.                 print("current pokemon caught:",pokemon)
  18.             elif b == 0:
  19.                 time.sleep(2)
  20.                 print("pidgey got away")
  21.         elif catch == "mew":
  22.             c = random.randint(0,5)
  23.         else:
  24.             print("i don't know")
  25.            
  26. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement