Now we will run a very basic Python program that will print Hello WomenWhoCode!
. This will allow you to run a basic Python program:
- from the terminal
- from your editor
Please copy the sample file below and save as first_python_code.py
.
Let's try to run some Python code!
- Open a terminal
Windows: Click Start -> Type cmd
Mac: Open Applications folder -> Utilities folder
- Go to the directory of the file by running the following command. If you need help finding the directory path, you can ask the mentor how.
cd <path to your copy of first_python_code>
- Run our
first_python_code.py
by typing the following command.
python first_python_code.py
or
python3 first_python_code.py
- This is your simple program that prints some text. The output should be
Hello WomenWhoCode!
Hello WomanWhoCode!
Hello WomenWhoCode!
Open the file using your text editor and run the code! You should see the same result.
- Open the file using your text editor.
- Inside the file, there is an instruction. Follow it! :)
- When you are done, save the file and run it again in your terminal and editor!
Hello WomenWhoCode!
Hello WomanWhoCode!
Hello WomenWhoCode!
Nicole loves Python!
Now you have run your first program!
- What is the extension of a Python file?
- What do you call the
cd
? What does it do? - What does the
print()
do? - What does the
.format()
do? - What is the magic of the
#
symbol?