So I've typed this up and I've gone over it for a couple of hours now and I can't seem to understand what is wrong with it. When I run it and I pick a choice, it just quits. I've used IDLE to run it and in order to run the functions dice () or guess () I have to do it manually. Thanks in advance
from random import randint
def main ():
print ("Choose a game.")
print ("1. Dice")
print ("2. Guess")
choice = input ("Enter your choice: ")
if choice == 1:
dice ()
elif choice == 2:
guess ()
elif choice == 'Q' or choice == 'q':
exit ()
def dice ():
rolling = True
while rolling:
n = input ("How many dice? ")
if n == 'M' or n == 'm':
main ()
elif n == 'Q' or n == 'q':
exit ()
else:
for i in range (int (n)):
print (randint (1, 6))
def guess ():
guessing = True
while guessing:
print ("Guess the number: 1-1000")
n = randint (1, 1000)
count = 0
wrong = True
while wrong:
g = input ("Guess: ")
if g == 'M' or g == 'm':
main ()
elif g == 'Q' or g == 'q':
exit ()
else:
if int (g) > n:
print ("Lower")
count += 1
elif int (g) < n:
print ("Higher")
count += 1
else:
print ("Correct")
count += 1
wrong = False
print ("You took " + str (count) + " guesses")
main ()