Python basics exercises
Short Python problems on variables, types and operators, each checked by tests as soon as you submit.
Beginner
- 1. Hello WorldThe first program everyone writes25 XP2 min
- 3. Simple MathA tiny calculator for two numbers25 XP2 min
- 4. Is Even?Odd or even, one number at a time30 XP3 min
- 5. Maximum of TwoPick the bigger of two numbers30 XP3 min
- 6. Absolute ValueHow far is a number from zero?35 XP4 min
- 201. Celsius to FahrenheitWhat does 37 degrees feel like on an American thermometer?25 XP3 min
- 203. Letter GradeTurn a test score into the letter on a report card25 XP4 min
- 220. Leap YearDoes this year get a February 29th?30 XP4 min
- 226. Shipping CostWhen is delivery free, and when do heavy boxes pay anyway?30 XP5 min
- 253. Split the BillDinner for a group, one card machine, and not a cent left over40 XP8 min
- 503. Cinema Ticket PriceThe box office keeps charging the wrong people25 XP3 min
- 506. Days in a MonthThirty days has September, and the code has to know it25 XP3 min
- 507. Dress for the WeatherCoat, sweater or T-shirt: what does today's temperature call for?25 XP3 min
- 509. Fuel Cost of a Road TripHow much will the drive to the beach cost in gas?25 XP3 min
- 519. Simple InterestHow much extra does money earn while it sits in the bank?25 XP3 min
- 531. Average Star RatingWhy does every product look a little worse than its reviews?30 XP4 min
- 532. Bill With Sales TaxThe price on the shelf is not the price at the checkout30 XP5 min
- 534. Cans of PaintHow many cans does it take to paint the bedroom wall?30 XP4 min
- 540. Days in a MonthThirty days has September, but what about February?30 XP5 min
- 546. Minutes to HoursA movie runs 135 minutes: how long is that on a clock?30 XP4 min
- 558. Which Quadrant?Find out where a point lands on the graph paper30 XP4 min
- 565. Electricity BillThe more power a home uses, the more each unit costs35 XP6 min
- 574. Tidy a NumberA form sends numbers as text: turn them back into numbers35 XP5 min
Other topics
- Strings
- Lists
- Dictionaries and sets
- Loops
- Functions
- Math
- Errors and exceptions
- File handling
- Modules and random
- Sorting and searching
- Two pointers
- Sliding window
- Stacks and queues
- Recursion and backtracking
- Dynamic programming
- Greedy
- Graphs
- Trees
- Bit manipulation
- Classes
- Iterators and generators
- Parsing
- Simulation
- Python idioms
- Regular expressions
- Codes and ciphers
- Working with data
- Grids and matrices
- Geometry
- Games and puzzles
- Heaps
- Data structures
Or see every challenge, with study plans, today's challenge and duels.