How can I make the function repeat if the answer is wrong, so the program chooses a new number.
Making a while loop
import random, sys
def randomNumber(diceRoll):
while True:
print('Pick a number 1 to 6')
userEntry = int(input())
if diceRoll == userEntry:
print('Correct')
sys.exit()
if diceRoll != userEntry:
print('Wrong, try again')
print('The number generated was ' + str(diceRoll))
continue
r = random.randint(1, 6)
outcome = randomNumber(r)
I want the program to ask the user the random number again if the user guessed wrong, but with a new number.