I'm a beginner at Python.
On the left, we specified the f function in the main If you run the main function, the f function also runs.
Let's define the f function separately like the right Running the main function results in an error stating that the local variable f is not declared.
How do I make it look like the one on the right side?
function local-variable main
There is no problem if you make it with the right side.
As a guess, the cell with def()
has not been executed, so you may not know f
.
Once you turn off your laptop, reload it, and run the intermediate cell again, the functions or variables defined in that cell are not yet created.
© 2024 OneMinuteCode. All rights reserved.