+ 5
What is wronh in this code: def my_func(x); assert x>0, "error" print(x) my_func(-1)
3 Réponses
+ 6
You placed a semicolon at the end of the line where the "my_func" function was declared, IIRC you should place a colon there instead:
It should be ...
def my_func(x):
Instead of ...
def my_func(x);
+ 1
The second time you do my_func() you might want to do x-1 instead of just -1, since -1 < 0 while x-1 loops until x <= 0
+ 1
Okk