scipiguy

Python 101: While Loop

Apr 22nd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. # Futurelearn: Python 101 from RPi Foundation - while loop
  2.  
  3. guess = input("guess my name ")
  4. num_guesses = 1
  5.  
  6. while guess != "Martin":
  7.     guess = input("wrong - guess again ")
  8.     num_guesses += 1
  9.    
  10. print("Well done. You made "+ str(num_guesses) + " guess(es).")
Advertisement
Add Comment
Please, Sign In to add comment