Save this video free

Lecture 10.1: Leap Years

Professor Rosen · 50:27 · Watch on YouTube

Part of Temple University CIS 1051. See all 23 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

The lesson builds a Python program that validates Gregorian-calendar dates in MM/DD/YYYY form, combining string slicing, integer conversion, conditionals, comparisons, and a Boolean leap-year function. It explains why the Gregorian rule differs from “every four years”, years divisible by 4 are leap years except century years not divisible by 400, and ends by steering students toward checking divisibility by 400 before 100 to simplify the logic.

Key takeaways

Chapters

0:00 Date Validation Exercise: Gregorian Rules and Python Skills
5:25 Why the Gregorian Calendar Corrected the Julian Calendar
12:53 Gregorian Adoption, Seasonal Drift, and Historical Date Labels
17:18 Python Slices for Extracting Date Components
23:20 Parsing MM/DD/YYYY into Integers
28:21 Grouping Months by Day Count with Python Membership
35:04 Validating Day Ranges with Chained Comparisons
41:32 Separating February 29 from Ordinary February Dates
44:38 Designing is_leap_year as a Boolean Function
48:43 Simplifying Leap-Year Logic by Checking 400 First

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:00 All right, start recording. And we've got signal from me talking. Great. Okay, so today we are going to continue working on uh another in-class exercise. This one is a another form of homework. We've also done this as a experiment sometimes that we've run in class where we use this as part of an experiment. It's a lot of fun. As I was saying, uh the name is inest. So, if you're um so you're going to learn a bit of Catholic history today um just because we're talking about papal stuff, but we're also going to learn a bit of astronomy and stuff. Again, like the previous one, this one is uh check for participation credit. So, you turn in what you've done. Um this one's also one that I grabbed from Savage's book. And I like this one

0:47 because it's non-trivial for every level of programmer. Okay, it is gonna primarily cover our if statements, um our module arithmetic arithmetic. We're going to do our string indexes um and it's adapted from another problem I used to do in Java from Savage's Java textbook. So what we're going to do today is we are going to take a we're going to write a program that given a string as input tests if the string is valid in the a valid date in the Gregorian calendar. Okay. Now that's very technical terms to say is it a valid date but like also at the same time it's not. We're checking if it's valid in the Cregorian calendar

1:35 because there's other calendar systems right? If you're Muslim, you have your, you know, you have the Islamic calendar that you follow. If you're Jewish like me, there's a Hebrew calendar as well, right? If you're from uh if you happen

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Professor Rosen.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.