+ 2
if Statements
"you should create it as a separate file and run it" please i don't understand what this means does it mean i should end the if statement before the second un-indented line is written
3 Respuestas
+ 2
It has nothing to do with if statements. Short programs you can run from the prompt. With longer programs it is more easy to put them in a file, save it, and then run that file.
When you use if statement your program is likely to get longer. That is probably why they made the remark.
+ 1
@Paul Jacobs
I see, thank you Paul
- 1
I think what it mean is sometimes the if statement gets very long so if you use separate files inside of it, it will make it easier to read.
import file.py
if x==1
call something from file.py
else
call otherthing from file.py
So you import what you need and then fetch the classes or functions that you need in the if statement.
I am also learning Python so does it make any sense?