← All languages
Python programs
Print, lists, files — then the rest of the language.
7 topics · 165 examples · ordered like a syllabus
New to Python? Follow the 20-chapter course. Want a quick check? Try the Python quiz (300 questions). The same programs, grouped for practice, are on Python exercises.
Open Hello, World!Topics, in order
Finish one. The next is the card below.
- 01Basic Python Programsprint, input, if, a bit of math. Week-one stuff. If this feels slow, skip ahead.
- Print "Hello, World!"
- Add Two Numbers
- Swap Two Variables
- 02Conditional Programsif / elif / else. Grades, vowels, triangle types. The bugs usually hide in the equal-to case.
- Grade Calculator
- Vowel or Consonant
- Character Classification (Digit / Alpha / Special)
- 03Loop Programsfor and while. Digits, patterns, Fibonacci. You will get tired of range() and that is the point.
- Print Numbers 1–100
- Print Even Numbers in Range
- Print Odd Numbers in Range
- 04String Programsreverse, palindrome, split, regex. Strings are where beginners leak hours.
- Reverse a String
- Check Palindrome String
- Count Vowels in String
- 05List Programssum, sort, slice, duplicates. Most interview warm-ups are this file.
- Sum of List Elements
- Largest Element in List
- Smallest Element in List
- 06Object-Oriented Programsclasses, inheritance, a singleton nobody asked for. Read __init__ twice.
- Create Class & Object
- Instance vs Class Variables
- Constructors in Python Classes
- 07File Handling Programsopen, read, write, json, csv. Always use with. Always.
- Read File
- Write File
- Append to File