I'm asking you about the execution of other functions in the main function

Asked 1 years ago, Updated 1 years ago, 101 views

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

2022-09-20 22:31

1 Answers

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.


2022-09-20 22:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.