Nov-04-2021, 03:57 AM
Please use bbcode tags for your python code (you can press the python button above the editor).
This code checks if the variable
(Nov-04-2021, 03:15 AM)Kenrichppython Wrote:if YesNo == f:
This code checks if the variable
YesNo
has the same value as the variable f
. But since you haven't assigned to the variable f
yet, this is an error. I suspect you wanted to check if it was the string f
. If so, you need to use quotes to define the string.if YesNo == "f":It is also a good idea not to use the same name for both a function and a variable in the function. Because they have different scope, this won't break immediately. But there are situations where this would cause confusion. Better to pick different names:
def username(): username = input("username:") #username used as function name and string name ...