This exercise will show you how to create your first Python program. Make sure Python is installed, then type the following text in a new file. Save it into your pycode
folder and call it firstprog.py
.
1 2 |
|
That's right! It is only two lines of code!
Once the code has been saved, open up a terminal window and change into the folder where you saved your code.
Then run your Python code file through the Python interpreter like so:
I am determined to learn Python. Today's date is
- Change what is inside the quotes on line 2 to include today's date. Save the file once you have made your changes and run the file again.
- Change what is inside the quotes on line 1 to have the computer display your name.
I, Graham Mitchell, am determined to learn Python. Today's date is Sunday, February 19, 2017.
©2017 Graham Mitchell