This page intentionally left blank Python for Software Design


prompt: Characters displayed by the interpreter to indicate that it is ready to take input from the user. script



tải về 1.38 Mb.
Chế độ xem pdf
trang9/83
Chuyển đổi dữ liệu13.08.2023
Kích1.38 Mb.
#55046
1   ...   5   6   7   8   9   10   11   12   ...   83
- Python for Software Design How to Think Like a Computer Scientist-Cambridge University Press (2009)

prompt: Characters displayed by the interpreter to indicate that it is ready to take
input from the user.
script: A program stored in a file (usually one that will be interpreted).


1.8 Exercises
9
script mode: A way of using the Python interpreter to read and execute statements
in a script.
semantics: The meaning of a program.
semantic error: An error in a program that makes it do something other than what
the programmer intended.
source code: A program in a high-level language before being compiled.
syntax: The structure of a program.
syntax error: An error in a program that makes it impossible to parse (and therefore
impossible to interpret).
token: One of the basic elements of the syntactic structure of a program, analogous
to a word in a natural language.
1.8
EXERCISES
Exercise 1.2
Use a Web browser to go to the Python Website (python.org). This page contains
information about Python and links to Python-related pages, and it gives you the
ability to search the Python documentation.
For example, if you enter print in the search window, the first link that appears is
the documentation of the print statement. At this point, not all of it will make sense
to you, but it is good to know where it is.
Exercise 1.3
Start the Python interpreter and type help() to start the online help utility. Or you
can type help('print') to get information about the print statement.
If this example doesn’t work, you may need to install additional Python documen-
tation or set an environment variable; the details depend on your operating system
and version of Python.
Exercise 1.4
Start the Python interpreter and use it as a calculator. Python’s syntax for math
operations is almost the same as standard mathematical notation. For example, the
symbols +, - and / denote addition, subtraction, and division, as you would expect.
The symbol for multiplication is *.
If you run a 10-kilometer race in 43 minutes 30 seconds, what is your average time per
mile? What is your average speed in miles per hour? (Hint: there are 1.61 kilometers
in a mile.)



tải về 1.38 Mb.

Chia sẻ với bạn bè của bạn:
1   ...   5   6   7   8   9   10   11   12   ...   83




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương