Harvard CS50P: Python Programming from ScratchLesson 1 · Welcome to CS50P
0/11

Harvard CS50P: Python Programming from Scratch

A complete beginner path through Python fundamentals and problem-solving.

11 lessonsAbout 16 hoursVideo by freeCodeCamp.org / Harvard CS50PFree certificate
0/11 done

Lesson 1 of 11 · Start with Python's building blocks · 4:48

Lessons

0 of 11 done · 3 chapters

Start with Python's building blocks

Welcome to CS50P

See the shape of the course and what it means to solve problems with Python.

Visual note · Lesson 2Returning a value is not printing it
About this course

This chapter

Learn the ideas every Python program uses to make decisions and repeat work.

By the end of the course you can build

  1. Write small Python programs with variables, functions, and control flow
  2. Handle errors, work with files, and use third-party libraries
  3. Test code and extract useful data with regular expressions
  4. Model real-world ideas with classes and object-oriented programming

Treat each lecture as a lab. Pause after a concept, write a tiny program without copying it, and keep one question to revisit in the next chapter.

Chapter quick checkCovers all 4 lessons

Quick check

3 questions on “Start with Python's building blocks”

Practice, not a test. Get 2 of 3 right to mark this chapter as checked.

1/3What does this program print?
def hello(to="world"):
    print("hello,", to)

hello()
hello("David")

2/3A user typed their name with extra spaces. What does this print?
name = "  david malan  "
print(name.strip().title())

3/3What does this match statement print?
name = "Hermione"
match name:
    case "Harry" | "Hermione" | "Ron":
        print("Gryffindor")
    case "Draco":
        print("Slytherin")
    case _:
        print("Who?")