Week_2_Variables_Control

Week_2_Variables_Control - CMPT120 J. Ye Variables &...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPT120 J. Ye Variables Control Structures (1) ( Week 2 ) Variables Arithmetic Conditional statements User Input CMPT120 J. Ye 1 Algorithm Program Representing information in computers representing unsigned and signed integers : binary system representing text Python interpreter and editor A few commonly-used Python built-in functions 2 Last week:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CMPT120 J. Ye In Python, comments are lines that start with a # Comments let you include information that is meant only for the programmer. The Python interpreter ignores comments. Comments make code easier to understand, thus easier to maintain When programming, you should be in the habit of writing comments describing what the code does Useful: if you need to comment out a Python code block, select the block, use alt+3 (alt+4 to reverse it) 3 Python Comments CPU and Main Memory -- two main components in computers 4 Main Memory Chip that executes program commands Primary storage area for programs and data that are in active use Synonymous with RAM Central Processing Unit
Background image of page 2
CMPT120 J. Ye Memory 5 Main memory is divided into many memory locations (or cells ) 9278 9279 9280 9281 9282 9283 9284 9285 9286 Each memory cell has a numeric address , which uniquely identifies it Storing Information (general discussion) 6 9278 9279 9280 9281 9282 9283 9284 9285 9286 10011010 Each memory cell stores a number of bits (e.g. 8 bits) which may represent an address or a value Large values are stored in consecutive memory locations 10001101 10001010
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CMPT120 J. Ye Variables hold “values” that may vary In computer programming, a variable is the name of a memory address (location) that can store a value or a piece of information. Python variables do not directly store values, but store
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

Week_2_Variables_Control - CMPT120 J. Ye Variables &...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online