+ 3
Difference between running a program in IDLE and terminal ?
a=str(input("entrsmth:")) b=int(input("entranmbr:")) print(a*b) I ran this in IDLE and it worked fine. But,when I run this directly from Ubuntu terminal using python, it shows NameError: name '(my input for a)' is not defined. works fine when I input a number for a. What's the difference when you run a program from IDLE and terminal?
1 Answer
+ 7
The main difference is that instructions are executed immediately in terminal, while IDE executes the whole code at once.
However, when in terminal, each instruction is "remembered" and so a once declared variable is always ready to ve invoked. While in IDE you have to declare it at each runtime.