Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # tip checking loop
- while True:
- # tip value question - not defined as integer to be able to get empty value
- answer = input("Give me the tip quantinty which you gave to Johnnemy 'hundred' Collins: ")
- # check if the answer is a number
- try:
- number = int(answer) # int('') will also raise ValueError
- except ValueError:
- print('Please enter a number')
- # there is no break here, so we will loop
- else: # if the answer is a number - check how much it is
- if number<0:
- print("You're kidding me. Please enter a positive number")
- # again, no break -- so loop
- elif number==0:
- print('ZERO?')
- break
- elif number < 100:
- print('Johnny says: Next time I spit in your soup')
- break
- elif number >= 100:
- print('Johnny says: SUPER!')
- break
- print('This is the end of this conversation')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement