Topics: Core Elements of Programs: strings, input/output, f-strings, operators, branching, indentation
Lecture Notes
Lecture 2: Strings, Input/Output, and Branching
Readings
Ch 2.3–2.4
Finger Exercise Lecture 2
Assume you are given a variable named number
(has a numerical value). Write a piece of Python code that prints out one of the following strings:
positive
if the variablenumber
is positivenegative
if the variablenumber
is negativezero
if the variablenumber
is equal to zero
6.100L Finger Exercises Lecture 2 Solutions