I'm making a program that gives you different basic operations to solve. If you choose subtraction, it also gives you a choice if negative numbers are allowed or not. If the user says "No", it's supposed to change the variable that determines the minuend to a different number and check if it's greater than the subtrahend, and if it isn't, it tries again.
I've tried using a while loop that keeps regenerating the minuend until it's greater than the subtrahend, I've tried placing after FAT1 (minuend) = random.randint(1,50) > FAT2 (subtrahend) or FAT1 = random.randint(1,50 > FAT2). I've also tried placing it in a function, or making a boolean used in the while loop instead of FAT1 < FAT2, but it keeps not working.
Variables I made throughout (all global):
FAT1 = first number (int)
FAT2 = second number (int)
OPER = the operation the user chooses (string)
NEG = if the user chooses yes or no to negative numbers (string)
Problematic part of the code:
#No negative numbers
elif NEG == "NO" or "No" or "no" or "nO" :
while True :
FAT1 = random.randint(1,50)
FAT2 = random.randint(1,50)
#Here it takes what the user typed and converts it in an int
TYP = input()
NUM = int(TYP)
while FAT1 < FAT2 :
FAT1 = random.randint(1,50)
RES = FAT1 - FAT2
print("What's",FAT1," - ",FAT2)
if NUM == RES :
print("Correct!")
elif NUM != RES :
print("Wrong! Try again!")
EDIT: As I said in my comment: I get the input before the problem gets made because the user may choose a different operation. This question could be clearer with the whole code, but i didn't feel like putting it all there because it felt redundant Here's the code: pastebin.com/ZfqhY2md
EDIT2: I tried making this dictionary at the beginning (all in one line):
dict = {'Addition': 'Addition', 'Subtraction': 'Subtraction', 'No': 'No',
'Yes': 'Yes'}
And at the beginning of every if statement i tried this:
if NEG == dict.get('Yes') :
And it works for every suite except the one with No to negative numbers... New full code here: https://pastebin.com/600TpkZe