hello im new to programing with python, i have this code arranged so a while loop can validate the Gamble variable in the start of the program and in the revaluation of the aformentioned variable. how can i make it so the the program works as is but without having it to write it twice?
def gamBling(Gamble):
while Gamble == 'yes' or Gamble == 'Yes' or Gamble == 'y' or Gamble =='Y':
betTing()
Gamble = input('Do you wish to play again? ')
while Gamble != 'yes' and Gamble != 'Yes' and Gamble != 'y' and Gamble != 'Y' and Gamble != 'No' and Gamble != 'no' and Gamble != 'N' and Gamble != 'n':
Gamble = input('Please anwser in either yes or no? ')
if Gamble == 'No' or Gamble == 'N' or Gamble == 'n' or Gamble == 'no':
print('okay, goodbye')
exit()
print('Any bet you make will be doubled if your number is higher than or equal to 5. Want to play? ' + '(Yes or No)')
Gamble = input()
while Gamble != 'yes' and Gamble != 'Yes' and Gamble != 'y' and Gamble != 'Y' and Gamble != 'No' and Gamble != 'no' and Gamble != 'N' and Gamble != 'n':
Gamble = input('Please anwser in either yes or no? ')
gamBling(Gamble)
I want to be able to run the program the way it runs now but without having to repeat the while loop, if it can be done.