Advertisement
Arcot

ch4 ex3

Jan 22nd, 2022
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. import random
  2.  
  3. result=False
  4. score=0
  5. while not result:
  6.   num=random.randrange(1000,10000)
  7.   print(num)
  8.   user_answer=input("guess if the above number is divisible by 13: ")
  9.   if user_answer=="yes" and num%13==0:
  10.     score+=1
  11.     print("good guess, try again")
  12.   elif user_answer=="no" and num%13!=0:
  13.     print("good guess, try again")
  14.     score+=1
  15.   else:
  16.     break
  17.  
  18. print("your score",score)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement