Created
May 15, 2019 01:02
-
-
Save Aero-Blue/76be633228ebcf922fe9c7355b2e8887 to your computer and use it in GitHub Desktop.
Simple high or low game solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
points = 0 | |
def get_num(): | |
return random.randint(1,1000) | |
def main(): | |
global points | |
print("Any number under 500 is low, 501 to 1000 is high") | |
direction = int(input("Make Your Selection:\n1. High\n2. Low\n3. Quit\n")) | |
num = get_num() | |
if direction is 1 and num >= 500 or direction is 2 and num < 500: | |
points+=1 | |
else: | |
points-=1 | |
print("The number was: {}".format(num)) | |
print("Your Points: {}".format(points)) | |
return str(input("Do you want to play again? Y/N ")) | |
while True: | |
answer = main() | |
if "y" not in answer: | |
break | |
else: | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment