Class 03 – Monday August 29
March on even though it’s August
Together we learn — To say what we mean to say — Most valuable skill
What makes me happy — Students asking their questions — So please keep it up.
That Black Lives Matter — Should be so easy to grasp — People are people
Look both ways
Quote of the day
- So early in my life, I had learned that if you want something, you better make some noise. — Malcom X
Last class – any questions?
What is happening today
- Continue our exploration of digital problem solving
- We will do this every class this semester
- Expand our communication and abstraction skills
- Readability and consistency
- Ideas and plans are only good if they can be easily understood.
- Must appreciate and strive for writing readable code
- Practice debugging
- Pay mindful attention to what our solutions actually say to do.
- Recognize naming allows us to interact with the world around us.
- Ability to name values is part of the essence of being human.
- Ability to name values is a cornerstone of programming. Variables will be the means to do so.
- Introduce how Python supports integer, decimal, and string values, and their manipulation.
- Introduce additional terminology to which you should become accustomed
Upcoming examples
- Program piaget.py
- Typos galore
- Code listing
Purpose: correct errant code
Author: Jim Cohoon
Id: jpc
print( We learn best, when we must invent. -- Jean Piaget
- Program xy.py
- Introduces naming and assignment operator
- Program xyx.py
- Introduces updated assignment
- Program arf_arf.py
- Program multiples.py
- Introduces multiple assignment
- Program intsy_bitsy
- Introduces the
int
type and integer arithmetic
- Program floatilla.py
- Introduces the
float
type and decimal arithmetic
- Program combine_replicate.py
- Introduces the string concatenation operator + and replication operator *.
- Program hip_hopping.py
- Introduces chrestomathics
- Program cast_away.py
- Introduces casting — converting a value of one type into a value of another type.
- Program mix_it_up.py
- Introduces the mixed mode numeric type and type conversion.
Terminology to which you should become accustomed
• Variable • Value • Operator | • Concatenation • Decimal division • Integer division | • Remainder • Mod • Type | • Type • Type • Type | • Keyword |
Python arithmetic
- The Python arithmetic operators are: addition:
+
; subtraction:-
; multiplication:*
; decimal division:/
; integer division://
; exponentiation:**
; remaindering:%
- If one of the operands of an arithmetic operation is decimal, the result is decimal; otherwise, the result is integer except for decimal division.
Identifiers and Keywords
- An identifier is a sequence of characters such that the first character is alphabetic and the remaining characters (if any) are alphabetic or numeric
- Python considers the underscore character (
_
) as alphabetic.
- Keywords are words reserved by Python for special usage; as such, they cannot be used to name things.
- For example, keyword
import
tells Python the contents of module (library) is to be included as a program resource.
To do list
- Review class artifacts
- Read and Reread
- Chrestomathics sections 0 - 3.
- The Coder's Apprenctice : sections 3 – 4
- And/or How to Think Like a Computer Scientist: Learning with Python 3: Sections 10.2 – 10.11