Python tasks
Every task in one place. Pick a mode, a topic or a concept to practise.
Short understanding tasks: multiple choice, predicting the output, finding the bug and completing code.
13 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
- Complete the codeElementaryEven numbers onlyLists · Theory and practiceReturn values: returnList methods: append, pop, remove, …Looping over a list
- 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
- Complete the codeElementaryWhere is the value?Algorithms · Theory and practiceReturn values: returnLinear search
- Code comprehensionElementaryA prime testAlgorithms · Theory and practiceReturn values: returnDivisibility, primes, GCD
- Complete the codeElementaryA dieModular programs · Theory and practiceReturn values: returnImporting modulesStandard modules: math, random
- Predict the outputIntermediatetry, except, else, finallyGraduation exam preparation · Exceptions (try – except)Return values: returntry – exceptKinds of exceptions: ValueError, ZeroDivisionError, …