2002 г, 43с.
Курс компьютерной физики на python
This document is a handbook used during 2002 as an introduction to programming for first year undergraduates studying physics at the University of Oxford. If you're interested in teaching programming (particularly using Python), then you may find Python in Education interesting. If you just want to learn the Python needed to write simple procedural programs of the kind used to solve problems in physics, then read on.
ContentsIntroduction The Python trial
Typographical conventions
Using the system Logging in
IDLE basics
Creating a new program
Opening existing programs
Saving programs
Closing programs
Programming using IDLE
Using the interactive interpreter
Using the editor
Case sensitivity
The elements of Python Hello world
Interpreters, modules, and a more interesting program
Variables
Names and Assignment
Types
Input and output
Arithmetic
for loops
An example of a for loop
Using the range function
if statements
An example of an if test
Comparison tests and Booleans
else and elif statements
while loops
Using library functions
Arrays
Making your own functions
File input and output
Putting it all together
Graphical output and additional Python Graphical output
Arrays in Python
Functions you may need for the first-year problems
Reading files
Random numbers
Scope
Python differences
for loops
Taking your interest further
Errors Attribute Errors, Key Errors, Index Errors
Name Errors
Syntax Errors
Type Errors
Reserved Words
About this document .