Sep-28-2021, 09:40 AM
(This post was last modified: Sep-28-2021, 09:50 AM by Yoriz.
Edit Reason: Formatting
)
hi,
I keep getting errors regarding variable definition.
I did defined the variable, yet the visual studio still getting the error:
the full code:
I keep getting errors regarding variable definition.
I did defined the variable, yet the visual studio still getting the error:
Error:Exception has occurred: NameError
name 'x' is not defined
File "D:\Studies\Python\Ex_Files_Learning_Python_Upd\Exercise Files\Ch2\conditionals_start.py", line 10, in <module>
if(x<y):
(the errors occurs at line 10)the full code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# # Example file for working with conditional statements # def main(): x, y = 1000 , 100 # conditional flow uses if, elif, else if (x<y): st = "x is less thay y" else : st = "x is grater thay y" print (st) # conditional statements let you use "a if C else b" if __name__ = = "__main__" : main() |