Skip to content

Commit 24e37bd

Browse files
committed
add explanation of working in a text editor and how to run files in python
1 parent b525f36 commit 24e37bd

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

python/lesson1/tutorial.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ title: Strings, Integers and Floats
66
In this tutorial, we're going to start to work with the basic types of Python:
77
strings (for text) and integers & floats (for numeric values).
88

9+
Notice that in this tutorial you are working in REPL (IDLE). You find more information
10+
on REPL and how to start Python in your `cmd` or `terminal` in the [Installing Python tutorial](python/lesson0/tutorial.html) .
11+
912
## Hello, World!
1013

1114
In keeping with tradition, we're going to start by printing "Hello, World!" to
@@ -121,6 +124,30 @@ multiple things at once, separated by a comma:
121124

122125
>>> print('The result of 2 + 2 is', 2 + 2)
123126

127+
### Saving Your Work
128+
129+
In this tutorial you coded in the REPL (IDLE), but a lot of times you want
130+
to save your code instead. In these casees you would use a text editor.
131+
We give some information on text editors in our [Getting started guide](general/setup/tutorial.html) .
132+
133+
Open your text editor and write the code from the first exercise:
134+
135+
print("Hello, World!")
136+
137+
Save the file as `ex1.py`. You can name your files as you like,
138+
but they should end with `.py`, so python can read them easily.
139+
Reading your file into Python you will use your `cmd` or `terminal` shell again.
140+
You can read your file with the following command (type without the $ sign):
141+
142+
$ python ex1.py
143+
144+
If you have `>>>`in front of your code, you are still in REPL(IDLE) and need to exit
145+
it with:
146+
147+
>>> quit()
148+
149+
Than you should be able to load the file.
150+
124151
This concludes today's tutorial. In the next tutorial, we'll find out how to
125152
combine the results of multiple separate expressions using variables, get input
126153
from the user, and make decisions based on that information.

0 commit comments

Comments
 (0)