Practice exam · Python Programming · Level Foundation

Python Programming Foundation – Practice Exam

Your first steps: test your basic knowledge risk-free – with solutions and explanations.

Python Programming Foundation badge

Exam rules

Duration40 minutes
Questions30 (randomly selected)
Pass mark70%
Question typesSingle choice and multiple choice
Exam languageGerman, English, French, Polish
PriceFree
Attempts allowedUnlimited
Waiting period between attemptsNone
Solutions after submissionWith explanations
  • The timer starts immediately and keeps running on the server – even if you close the window or lose your connection.
  • Every answer is saved automatically. You can reopen and continue the exam at any time until the time runs out.
  • When the time is up, the exam is submitted automatically with your saved answers.
  • Unanswered questions count as wrong. A question only counts if you have selected all the correct answers and no wrong ones.
  • Copying, printing and the context menu are disabled. We log when and for how long the exam window was in the background, as well as copy attempts.
  • Every attempt you start counts – even if you do not submit it.
  • You may use notes and documentation, but not AI. Before you start, you accept the non-disclosure agreement (NDA): questions and solutions must not be shared.
  • Using AI counts as cheating. If you cheat, the attempt is voided; serious cases lead to an exam ban and the revocation of all certificates.
  • On request, you can get an exam accommodation with 25, 50 or 100% extra time. You can apply for it in your account under Exam accommodation.

The Exam Regulations apply.

What the exam covers

The questions are spread across the topic areas of Python Programming Foundation according to their weighting.

No.TopicWeightingQuestions
1 Syntax, data types and operators How a Python program is structured and how it handles numbers, text and Boolean values. 40% 12
2 Conditions and loops Controlling the flow of a program – with indentation instead of curly braces. 30% 9
3 Functions and lists Reusing code in functions and managing multiple values in lists. 30% 9

All learning objectives for this certification →

Sample questions with solutions

This is what the questions look like. We wrote these examples specifically for this page; they do not appear in the practice exam. Think about your answer before you reveal the solution.

Example 1 · Single choice · Topic area 1: Syntax, data types and operators

What does the following code output?

minutes = 135
print(f'{minutes // 60} h {minutes % 60} min')
  • A 2.25 h 15 min
  • B 2 h 15 min
  • C 2 h 0.25 min
  • D {minutes // 60} h {minutes % 60} min
Show solution

Correct answer: B

// performs integer division: 135 // 60 gives 2. % returns the remainder of that division: 135 % 60 gives 15. In an f-string, the expressions in curly brackets are evaluated and inserted. 2.25 would be the result of 135 / 60.

Example 2 · Single choice · Topic area 2: Conditions and loops

What does the following code output?

temp = 18
raining = True
if temp > 25:
    plan = 'swim'
elif temp > 15 and not raining:
    plan = 'hike'
elif raining:
    plan = 'museum'
else:
    plan = 'read'
print(plan)
  • A swim
  • B hike
  • C museum
  • D read
Show solution

Correct answer: C

Python checks the conditions from top to bottom and runs only the first branch whose condition is true. temp > 25 is false. temp > 15 and not raining is false as well, because not raining gives False – with and, both parts must be true. raining is true, so plan becomes 'museum'; the else branch is skipped.

Example 3 · Multiple choice · Topic area 3: Functions and lists

Which statements are true after the following code has run?

def add_item(items, item):
    items.append(item)


shopping = ['bread']
result = add_item(shopping, 'milk')
  • A shopping contains two elements.
  • B result has the value None.
  • C result is the list ['bread', 'milk'].
  • D shopping[1] has the value 'bread'.
Show solution

Correct answers: A, B

append() changes the list that was passed in directly: items and shopping refer to the same list, which then contains ['bread', 'milk']. The function has no return, so it returns None. Indexes start at 0, so shopping[1] is 'milk'.

In the practice exam you answer 30 questions like these and, after submitting, see the solution and explanation for each one.