Python tasks
Every task in one place. Pick a mode, a topic or a concept to practise.
Programming tasks with tests, from easier to demanding.
15 tasks
- Write a programBasicAre they all different?Sets · Programming challengeslen, sum, min, max and sortedSets and unique items
- Write a programBasicThe largest and the smallest numberGraduation exam preparation · Listswhile loopsList methods: append, pop, remove, …len, sum, min, max and sortedFinding the minimum and maximum
- Write a programElementaryNames sorted into a fileWorking with files · Programming challengeslen, sum, min, max and sortedReading from a fileWriting to a fileThe with statement
- Write a programElementaryGrade statistics in functionsModular programs · Programming challengesReturn values: returnlen, sum, min, max and sortedSplitting a program into functions
- Write a programElementaryCharacters and wordsGraduation exam preparation · StringsString methods: upper, find, replace, …Splitting and joining: split() and join()len, sum, min, max and sorted
- Write a programElementarySki jumpersGraduation exam preparation · ListsFormatting output: sep, end, f-stringsReturn values: returnLooping over a listlen, sum, min, max and sorted
- Write a programElementaryEven and odd, sortedGraduation exam preparation · ListsInteger division and remainder: // and %while loopsList methods: append, pop, remove, …len, sum, min, max and sorted
- Write a programElementaryThe second largest numberGraduation exam preparation · ListsList methods: append, pop, remove, …len, sum, min, max and sortedSets and unique itemsFinding the minimum and maximum
- Write a programElementaryThe most frequent elementGraduation exam preparation · ListsSplitting and joining: split() and join()List methods: append, pop, remove, …len, sum, min, max and sortedFinding the minimum and maximum
- Write a programElementaryMinimum, count and positionsGraduation exam preparation · Mixed tasksReturn values: returnLooping over a listlen, sum, min, max and sortedFinding the minimum and maximum
- Write a programElementaryTest scoresGraduation exam preparation · Mixed tasksFormatting output: sep, end, f-stringswhile loopsList methods: append, pop, remove, …len, sum, min, max and sortedtry – except
- Write a programElementaryA safe averageGraduation exam preparation · Exceptions (try – except)while loopslen, sum, min, max and sortedtry – exceptKinds of exceptions: ValueError, ZeroDivisionError, …
- Write a programIntermediateTotal points and rankingDictionaries · Programming challengeslen, sum, min, max and sortedTuples and immutabilityLooping over a dictionary: keys, values, itemsCounting occurrences
- Write a programIntermediateAverage points per classAdvanced data structures · Programming challengeslen, sum, min, max and sortedLooping over a dictionary: keys, values, itemsLists of dictionaries and nested structures
- Small projectIntermediateShopping basketGraduation exam preparation · ListsFormatting output: sep, end, f-stringswhile loopsList methods: append, pop, remove, …len, sum, min, max and sorted