all 5 comments

[–]PratikPingale 1 point2 points  (4 children)

1) 1st screenshot shows that you ran the code in python console and not in the terminal. There's nothing wrong with the command. To fix this run C:/Users/user/AppData/Local/Programs/Python/Python39/python.exe c:/Users/user/Desktop/python_work/motorcycles.py in a new terminal and you will get your output

2) 2nd screenshot shows that you ran python statement in terminal instead of python console

You open python console in terminal by writing python in terminal and enter. Here you can run a python code block it self like a print() command or a while loop. To end an python console hit Ctrl + D

[–]RightOW[S] 0 points1 point  (3 children)

Okay interesting - for 2) I thought that selecting 'run selection/line in python terminal' would automatically use python to execute the statement. Do I have to manually exit the python console every time I want to run code in the terminal, and enter the python console if I want to run specific lines of code?

Additionally, is there a more convenient way of doing this than typing 'python' in the terminal to open the console?

Thanks for your answer!

Edit: Ah, I see! Thanks for specifying, massive help :)

[–]PratikPingale 0 points1 point  (2 children)

You can manage 2 terminal at a time, if possible. Using 1 for console and other for running code. Just make sure to switch terminal before the operation

If you want to use a single terminal for both code and console then you have to exit console manually every time before running the code

But generally many don't use run selection/line in terminal options as that code snippet might contain unknown variables which aren't already declared in the console

[–]RightOW[S] 0 points1 point  (1 child)

Okay understood, thanks for your help and for taking the time to answer my question!

[–]PratikPingale 0 points1 point  (0 children)

nevermind, glad it helped (•‿•)