CSCA08H3 Final: Python Introductory Examples

79 views1 pages
19 Oct 2011
School
Course

Document Summary

Python introductory examples: define a variable and give it a value. Examples: time = 3 num = 30 + 10 num = time + 2. When defining a variable you must have the variable name on the left hand side, then an equal sign, then an expression: write an expression, you can try this out in the python shell. 30 + 10 num + 20. 2 time + num. An expression is a phrase of code that python evaluates to produce a value: write a statement. At this point in the course you have only seen assignment statements. Examples: num = num * 2 time = 3. # statement that doubles the value of num. # statement that assigns the value 3 to time. Python statements are always commands to do something (never statements of fact, or questions).

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents

Related Questions