Python function exercises
Write Python functions with parameters, defaults and return values, and let the tests check them in your browser.
Beginner
- 8. Default ParametersA greeting that works with or without a name35 XP3 min
- 200. Apply TwiceGive a function a second go at its own answer25 XP3 min
- 221. Make a MultiplierA factory that builds doublers, triplers and every other kind30 XP4 min
- 239. Make a CounterA tally that remembers where it got to between calls35 XP5 min
- 510. Keep It in RangeStop a volume knob from going past its limits25 XP3 min
- 514. Repeat With DefaultsSay it once, say it twice, say it however you like25 XP3 min
- 527. Valid PINWill the cash machine accept the code that was typed?25 XP3 min
- 549. Price With TaxA checkout that ignores the tax rate it is given30 XP3 min
- 550. Smallest, Largest and AverageThree facts about a list of numbers, handed back in one go30 XP4 min
- 568. Multiply by AddingMultiplication for a calculator whose times key is broken35 XP5 min
- 573. Strong Password CheckIs this password strong enough to keep an account safe?35 XP6 min
Intermediate
- 15. Multiply All ArgumentsMultiply however many numbers you are given55 XP5 min
- 19. Custom FilterKeep only the items that pass a test65 XP6 min
- 276. Run OnceDo the expensive setup the first time and never again60 XP10 min
- 301. Build Your Own partialFill in some arguments now and the rest later70 XP12 min
- 322. Retry on ErrorNetworks hiccup: give a shaky call a few more chances75 XP15 min
- 343. Type-Checked ArgumentsCatch the wrong kind of argument at the door, by name90 XP20 min
- 596. A List of MultipliersA row of functions: times one, times two, times three70 XP10 min
- 598. Add to the PlaylistSongs from yesterday keep turning up in today's playlist70 XP10 min
Advanced
Expert
Other topics
- Python Basics
- Strings
- Lists
- Dictionaries and sets
- Loops
- 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.