Python tasks
Every task in one place. Pick a mode, a topic or a concept to practise.
Exam-style tasks. Each shows the concepts it needs - review them first if you like.
25 tasks
- Write a programIntermediateMind readerGraduation exam preparation · StringsReading numbers from inputInteger division and remainder: // and %while loopsReturn values: returntry – except
- Algorithmic problemElementaryGreatest common divisorGraduation exam preparation · StringsInteger division and remainder: // and %while loopsDivisibility, primes, GCD
- Small projectIntermediateShopping basketGraduation exam preparation · ListsFormatting output: sep, end, f-stringswhile loopsList methods: append, pop, remove, …len, 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 programElementaryVowel or consonantGraduation exam preparation · ListsSeveral branches: elifwhile loopsString methods: upper, find, replace, …Membership: in
- Write a programElementaryGuest namesGraduation exam preparation · Listswhile loopsString methods: upper, find, replace, …Splitting and joining: split() and join()List methods: append, pop, remove, …
- Write a programBasicEntered values reversedGraduation exam preparation · ListsReading numbers from inputwhile loopsSlicingList methods: append, pop, remove, …
- 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 programElementaryTime in secondsGraduation exam preparation · The while loopReading numbers from inputFormatting output: sep, end, f-stringsInteger division and remainder: // and %while loops
- Write a programBasicGuess the wordGraduation exam preparation · The while loopInput with input()The if statementwhile loopsString methods: upper, find, replace, …
- Write a programBasicNumbers without 3, 7 and 14Graduation exam preparation · The while loopReading numbers from inputLogical operators: and, or, notThe if statementwhile loops
- Write a programBasicEven numbers up to a limitGraduation exam preparation · The while loopReading numbers from inputwhile loops
- Write a programBasicCharacters and their positionsGraduation exam preparation · The while loopInput with input()while loopsIndexing characters
- Write a programBasicCounting down to 5Graduation exam preparation · The while loopReading numbers from inputThe if statementwhile loops
- Write a programBasicOdd numbers except 17Graduation exam preparation · The while loopComparisons: ==, !=, <, >=The if statementwhile loops
- Algorithmic problemElementaryThe Collatz sequenceGraduation exam preparation · The while loopReading numbers from inputInteger division and remainder: // and %Two branches: if – elsewhile loops
- Algorithmic problemElementaryTo binaryGraduation exam preparation · The while loopText: the str typeReading numbers from inputInteger division and remainder: // and %while loops
- Write a programElementaryLotteryGraduation exam preparation · Mixed taskswhile loopsReturn values: returnList methods: append, pop, remove, …Standard modules: math, random
- Write a programElementaryPrime numbersGraduation exam preparation · Mixed tasksInteger division and remainder: // and %while loopsReturn values: returnDivisibility, primes, GCD
- 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 programBasicTrain passengersGraduation exam preparation · Mixed tasksReading numbers from inputThe if statementwhile loopsCounting and summing in a loop
- Write a programBasicA numeric passwordGraduation exam preparation · Exceptions (try – except)while loopsbreak and continuetry – exceptValidating input
- Small projectElementaryGuess a number from 1 to 50Graduation exam preparation · Exceptions (try – except)Several branches: elifwhile loopstry – exceptValidating inputStandard modules: math, random
- Write a programElementaryA bounded Fibonacci sequenceGraduation exam preparation · Exceptions (try – except)Reading numbers from inputwhile loopsList methods: append, pop, remove, …try – except
- Write a programElementaryA safe averageGraduation exam preparation · Exceptions (try – except)while loopslen, sum, min, max and sortedtry – exceptKinds of exceptions: ValueError, ZeroDivisionError, …