Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Write a function called guessNum(num). This function will play "guess the number" with the user.
- The number should be set to 60. Users will keep inputting numbers until 5 tries.
- The values are passed as arguments to the function.
- If the user guesses the number by the 5th try print "You won", if not print "You lost".
- '''
- def guessNum(num):
- for w in range(0,5):
- guess = int (input ("Guess the number: "))
- if guess == num:
- print ("You won")
- return
- print ("You lost")
- def main():
- guessNum(60)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement