New course! Every coder should learn Generative AI!
Try a free lesson+ 2
You are return a value so it requires a variable to store it so instead of
foo(1)
use this: i=foo(1)
Then it will be correct.
Happy coding
+ 1
it is not an code error, it is a logical error, the value of i will never change because the varable "i" outside the functcion isn't the same variable "i" inside the function
- 1
ok, it's giving an IndentationError bcz there are 3 space indentations not 4.
Use 4 spaces or 1 tab before i=i+1 and return i