@@ -34,70 +34,43 @@ Most operating systems other than Windows already have Python installed
34
34
by default. To check that Python is installed, open a command line
35
35
(typically by running the "Terminal" program), and cd to the
36
36
google-python-exercises directory. Try the following to run the hello.py
37
- program (what you type is shown in bold ):
37
+ program (what you see here is what you type ):
38
38
39
- ~/google-python-exercises$ python hello.py
40
- Hello World
41
- ~/google-python-exercises$ python hello.py Alice
42
- Hello Alice
43
-
44
- If python is not installed, see the [ Python.org
45
- download] ( http://python.org/download ) page. To run the Python
46
- interpreter interactively, just type "python" in the terminal:
39
+ python3 hello.py
47
40
48
- ~/google-python-exercises$ python
49
- Python 2.7.12 (default, Nov 19 2016, 06:48:10)
50
- [GCC 5.4.0 20160609] on linux2
51
- Type "help", "copyright", "credits" or "license" for more information.
52
- >>> 1 + 1
53
- 2
54
- >>> you can type expressions here .. use ctrl-d to exit
41
+ You will see:
55
42
56
- For this course, you want a python version that is 2.7 or later.
43
+ Hello World
57
44
58
- ### Execute Bit (optional)
45
+ type:
59
46
60
- The commands above are the simplest way to run python programs. If the
61
- "execute bit" is set on a .py file, it can be run by name without having
62
- to type "python" first. Set the execute bit with the "chmod" command
63
- like this:
47
+ python3 hello.py Alice
64
48
65
- ~/google-python-exercises$ chmod +x hello.py
66
- ~/google-python-exercises$ ./hello.py ## now can run it as ./hello.py
67
- Hello World
49
+ see:
68
50
69
- Python on Windows
70
- -----------------
51
+ Hello Alice
71
52
72
- Doing a basic Python install on Windows is easy:
53
+ If python is not installed, see the [ Python.org
54
+ download] ( http://python.org/download ) page. To run the Python
55
+ interpreter interactively, just type "python3" (eventially everyone will switch
56
+ over to Python3 and the command will become just "python") in the terminal:
73
57
74
- - Go to the [ python.org download] ( http://www.python.org/download/ )
75
- page, select a version such as 2.7. Google's Python Class should
76
- work with any version 2.7.
77
- - Run the Python installer, taking all the defaults. This will install
78
- Python in the root directory and set up some file associations.
58
+ python3
79
59
80
- With Python installed, open a command prompt (Accessories > ; Command
81
- Prompt, or type 'cmd' into the run dialog). Cd to the
82
- google-python-exercises directory (from unzipping
83
- google-python-exercises.zip). You should be able to run the hello.py
84
- python program by typing "python" followed by "hello.py" (what you type
85
- is shown in bold):
86
- C:\google-python-exercises> python hello.py
87
- Hello World
88
- C:\google-python-exercises> python hello.py Alice
89
- Hello Alice
60
+ and you will see this header and can then type in your own commands and
61
+ see the results:
90
62
91
- If this works, Python is installed. Otherwise, see [ Python Windows
92
- FAQ] ( http://www.python.org/doc/faq/windows/ ) for help.
63
+ Python 3.6.7 (default, Oct 22 2018, 11:32:17)
64
+ [GCC 8.2.0] on linux
65
+ Type "help", "copyright", "credits" or "license" for more information.
66
+ >>> 1+1
67
+ 2
68
+ >>>
93
69
94
- To run the Python interpreter interactively, select the Run... command
95
- from the Start menu, and type "python" -- this will launch Python
96
- interactively in its own window. On Windows, use Ctrl-Z to exit (on all
97
- other operating systems it's Ctrl-D to exit).
70
+ Type ctrl-z (on windows) or ctrl-d (on linux/macs) to exit.
98
71
99
- Editing Python (all operating systems)
100
- --------------------------------------
72
+ Editing Python
73
+ --------------
101
74
102
75
A Python program is just a text file that you edit directly. As above,
103
76
you should have a command line open, where you can type "python hello.py
0 commit comments