Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # https://www.reddit.com/r/learnpython/comments/4vxv9g/need_some_help/
- #
- import random
- while True:
- while True:
- num1 = int(input("Enter a number between 1 and 25: "))
- if num1 > 25:
- print("You must select a number less than 25!")
- else:
- break
- while True:
- num2 = int(input("Enter another number betwenn 1 and 25: "))
- if num2 > 25:
- print("You must select a number less than 25!")
- else:
- break
- num3 = random.randrange(1, 25)
- num4 = random.randrange(1, 25)
- print("You picked {} and {}".format(num1, num2))
- if num1 == num3:
- print("CONGRAGULATIONS!!! YOU GUESSED RIGHT!!!")
- else:
- print("Sorry you were not correct the first number was:", num3)
- if num2 == num4:
- print("CONGRAGULATIONS!!! YOU GUESSED RIGHT!!!")
- else:
- print("Sorry you were not correct the second number was:", num4)
- print("End of guessing game")
- print("Would you like to try again? yes or no")
- user_input = input(": ").lower()
- # if user_input in ('no', 'n'):
- # if user_input and user_input[0] == 'n': # if len(user_input) > 0 and user_input[0] == 'n'
- if user_input == "no" or user_input == "n":
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement