-1

Just getting started using PYTHON. I am not working AT THE COMMAND LINE (not on UNIX, not on LINUX). I have a DESKTOP folder with prog1.py and from the PC --> START --> I get to the PYTHON ICON. How do I use this "PC environment / non-unix command line" to compile and run ? Thank you - - - Cesar

Here is what is installed. PYTHON 3.8 (64-bit) -AND- IDLE PYTHON 3.8 -AND- MANUALS

I typed my first program prog1.py and it is on the PC DESKTOP

Which ICON do I choose to compile and run prog1.py

# Program to add two numbers,  `prog1.py`    
num1 = 15
num2 = 12


# Adding two nos
sum = num1 + num2 

# Printing values
print("Sum of {0} and {1} is {2}" .format(num1, num2, sum))
Cesar
  • 7
  • 2

1 Answers1

1

If python is in your PATH, you can go on your terminal, cd into your prog1.py folder and type:

python prog1.py

If python is not on your PATH, you will have to type the full path to python:

{path_to_python} prog1.py
John
  • 69
  • 3