I cannot understand this syntax error... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I cannot understand this syntax error...

I started to learn functions in Python; then when I used in main function in one of my assignments in my course. The code is: def func(num1, num2): if num1 > num2: return (num1 - num2)**2 return (num2 - num1)**2 def main(): num1 = 1 num2 = 2 print(func(num1, num2) if __name__ == "__main__": main() and I get: "invaild syntax".

13th May 2021, 11:23 AM
Omer Asayag
Omer Asayag - avatar
1 Answer
+ 2
First you should clear about why are you want to add main in your code. You should learn about main https://www.sololearn.com/learning/2488/
13th May 2021, 11:26 AM
Sâñtôsh
Sâñtôsh - avatar