Advertisement
Guest User

Untitled

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