Skip to content

Instantly share code, notes, and snippets.

@mbjames
Created May 11, 2021 22:47
Show Gist options
  • Save mbjames/54514b1807d63aa6b20da81050cfb35e to your computer and use it in GitHub Desktop.
Save mbjames/54514b1807d63aa6b20da81050cfb35e to your computer and use it in GitHub Desktop.
Random Number Generator
import random
def random_number():
print("\n Type (r) to generate a random number. (0 - 1000)")
print(" Type (q) to exit.")
answer = input("\n > ")
if answer == "r":
x = random.randint(0, 1000)
print("\n Number Generated:", x)
random_number()
elif answer == "q":
exit()
else:
random_number()
random_number()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment