




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An introduction to Python functions, including expressions, arithmetic operators, integer division, while loops, for loops, and function definitions. It also covers variable scope and the difference between arguments and parameters. Examples and exercises are included.
Typology: Study notes
1 / 116
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