




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Programming Basics^ The Console Images Data structures Midterm Graphics Object-Oriented Programming Everyday Python
Today’s questions How do we translate what we know from Karel into regular Python code? How can we make our code more flexible by producing different outputs depending on the input?
Today’s topics
Sonja Johnson-Yu
Sonja Johnson-Yu
Sonja Johnson-Yu
Review
A variable is a container for storing a data value. num_flowers = 5 num_flowers 5 variable’s name
A variable is a container for storing a data value. num_flowers = 5 num_flowers 5 variable’s value
Expressions
● The computer evaluates expressions to a single value ● We use operators to combine literals and/or variables into expressions
● 5 + 1 // 2 ● 9 // 3 ● 8 // 3 ● -8 // 3 Integer division takes the largest integer that is equal to or smaller than the quotient