r/PythonLearning • u/iug3874 • Feb 20 '25
Why does If/Else Not Work?
Everytime I Run it, it is Always 'else', even when 'if' would be right
9
Upvotes
r/PythonLearning • u/iug3874 • Feb 20 '25
Everytime I Run it, it is Always 'else', even when 'if' would be right
7
u/Refwah Feb 20 '25 edited Feb 20 '25
ais a string,ris being coerced into an int (r = int(ran)), so they cannot equal each otherVery easy would be coercing
ainto an int and then doing the comparison after that, given you seem to be operating onaas an int anyway