Python tasks
Every task in one place. Pick a mode, a topic or a concept to practise.
Every task of the course, from quick understanding checks to exam-style problems.
38 tasks
- Predict the outputBasicWhat the function returnsFunctions · Theory and practiceDefining and calling functionsReturn values: return
- Predict the outputElementaryA function without returnFunctions · Theory and practiceParameters and argumentsReturn values: return
- Multiple choiceBasicThe return statementFunctions · Theory and practiceReturn values: return
- True / falseBasicTwo parametersFunctions · Theory and practiceParameters and argumentsReturn values: return
- Complete the codeElementaryThe larger of two numbersFunctions · Theory and practiceThe if statementParameters and argumentsReturn values: return
- Write a programBasicFunctions for a rectangleFunctions · Programming challengesDefining and calling functionsParameters and argumentsReturn values: return
- Write a programElementaryThe largest of threeFunctions · Programming challengesSeveral branches: elifParameters and argumentsReturn values: return
- Write a programIntermediateThe least common multipleFunctions · Programming challengeswhile loopsDefining and calling functionsReturn values: return
- Complete the codeElementaryEven numbers onlyLists · Theory and practiceReturn values: returnList methods: append, pop, remove, …Looping over a list
- Write a programElementaryWhere the smallest item isLists · Programming challengesReturn values: returnCreating lists and indexingLooping over a list
- Write a programIntermediateShifting by k placesLists · Programming challengesReturn values: returnSlicingCreating lists and indexing
- Predict the outputElementaryA function returns two valuesTuples · Theory and practiceReturn values: returnReturning several values
- Complete the codeElementaryQuotient and remainder at onceTuples · Theory and practiceInteger division and remainder: // and %Return values: returnReturning several values
- Complete the codeElementaryHow often each word appearsDictionaries · Theory and practiceReturn values: returnCounting occurrences
- Write a programBasicA reversed dictionaryDictionaries · Programming challengesReturn values: returnKeys and valuesLooping over a dictionary: keys, values, items
- Complete the codeElementaryWhere is the value?Algorithms · Theory and practiceReturn values: returnLinear search
- Code comprehensionElementaryA prime testAlgorithms · Theory and practiceReturn values: returnDivisibility, primes, GCD
- Write a programBasicAll occurrencesAlgorithms · Programming challengesReturn values: returnList methods: append, pop, remove, …Linear search
- Write a programElementaryChecking the sides of a rectangleExceptions · Programming challengesReturn values: returnKinds of exceptions: ValueError, ZeroDivisionError, …Raising an exception: raise
- Complete the codeElementaryA dieModular programs · Theory and practiceReturn values: returnImporting modulesStandard modules: math, random
- Write a programElementaryGrade statistics in functionsModular programs · Programming challengesReturn values: returnlen, sum, min, max and sortedSplitting a program into functions
- Write a programIntermediateEstimating π by chanceModular programs · Programming challengesCounting and summing in a loopReturn values: returnStandard modules: math, random
- Write a programElementaryThe medianAlgorithmic problems · Programming challengesReturn values: returnSortingEdge cases
- Write a programIntermediateCounting pairs with a sum - fastAlgorithmic problems · Programming challengesReturn values: returnCounting occurrencesEfficiency of a solution
- Write a programIntermediateMind readerGraduation exam preparation · StringsReading numbers from inputInteger division and remainder: // and %while loopsReturn values: returntry – except
- Write a programElementaryA number inside a random numberGraduation exam preparation · StringsConverting types: int(), float(), str()Return values: returnString methods: upper, find, replace, …Standard modules: math, random
- Small projectElementaryRock, paper, scissorsGraduation exam preparation · StringsLogical operators: and, or, notSeveral branches: elifReturn values: returnStandard modules: math, random
- Write a programElementaryElements that occur only onceGraduation exam preparation · ListsReturn values: returnList methods: append, pop, remove, …Looping over a listStandard modules: math, random
- Write a programElementarySki jumpersGraduation exam preparation · ListsFormatting output: sep, end, f-stringsReturn values: returnLooping over a listlen, sum, min, max and sorted
- Write a programBasicA random list reversedGraduation exam preparation · ListsReturn values: returnSlicingLooping over a listStandard modules: math, random
- Write a programBasicSum of even numbersGraduation exam preparation · ListsInteger division and remainder: // and %Counting and summing in a loopReturn values: returnLooping over a list
- Write a programElementaryCommon elements of two listsGraduation exam preparation · ListsReturn values: returnList methods: append, pop, remove, …Looping over a listMembership: in
- 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 programElementaryMinimum, count and positionsGraduation exam preparation · Mixed tasksReturn values: returnLooping over a listlen, sum, min, max and sortedFinding the minimum and maximum
- Write a programElementaryPerfect numbersGraduation exam preparation · Mixed tasksInteger division and remainder: // and %for loops and range()Return values: returnDivisibility, primes, GCD
- Write a programBasicCoin tossGraduation exam preparation · Mixed tasksfor loops and range()Counting and summing in a loopReturn values: returnStandard modules: math, random
- Predict the outputIntermediatetry, except, else, finallyGraduation exam preparation · Exceptions (try – except)Return values: returntry – exceptKinds of exceptions: ValueError, ZeroDivisionError, …