6.100L | Fall 2022 | Undergraduate

Introduction to CS and Programming using Python

Lecture 2: Strings, Input/Output, Branching

Topics: Core Elements of Programs: strings, input/output, f-strings, operators, branching, indentation

Lecture Notes

Lecture 2: Strings, Input/Output, and Branching

Lecture 2 Code


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 variable number is positive
  • negative if the variable number is negative
  • zero if the variable number is equal to zero

6.100L Finger Exercises Lecture 2 Solutions

Problem Set 1

Problem Set 1

Problem Set 1 Code

Course Info

As Taught In
Fall 2022
Learning Resource Types
Lecture Videos
Lecture Notes
Problem Sets
Programming Assignments with Examples
Recitation Notes