Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #example of condition controlled loop in python
- import random
- import time
- pokemon = 0
- def main():
- x = True #boolean data type
- while x == True:
- print("POKEMON ENCOUNTERS:(PICKONE TO CATCH) pidgey,mew")
- catch = input("which pokemon do you want to catch").lower()
- if catch == "pidgey":
- time.sleep(2)
- b = random.randint(0,1)
- if b == 1:
- print("you caught pidgey")
- global pokemon
- pokemon = pokemon + 1
- print("current pokemon caught:",pokemon)
- elif b == 0:
- time.sleep(2)
- print("pidgey got away")
- elif catch == "mew":
- c = random.randint(0,5)
- else:
- print("i don't know")
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement