Branches (if/elif/else)
Programming task — enter your code and have it checked. Most parts
read a value input() a and classify it; the check feeds in fixed inputs and compares your output character by character. Therefore give only
what is required (no additional texts). Part 3 is different: here
you define the value yourself — none input(). Like input()
works, it says in the instructions.
Part 1 — Is the number greater than 10?
if with else.
Exercise
- Read a whole number
int(input())there. - Is the number greater than 10, give exactly
groesser als 10out — otherwise, give exactlynicht groesser als 10out.
Pay attention to the limit: 10 is not greater than 10. Use one
if with else — you write the branch yourself.
Example: input 12 → Output groesser als 10; Input 10 → Output nicht groesser als 10.
Part 1 — Your Code
Loading Python…Tests
Part 2 — Positive or not?
if with else — Be careful with the 0.
Exercise
- Read a whole number
int(input())there. - Is the number greater than 0, give exactly
positivout — otherwise, give exactlynicht positivout.
Use one if with else. Pay attention to those 0: it is not positive and therefore must nicht positiv lead.
Example: input 7 → positiv; Input -4 → nicht positiv; Input 0 → nicht positiv.
Part 2 — Your Code
Loading Python…Tests
Part 3 — Even or Odd?
if/else with modulo — here without input().
Exercise
- Define yourself an integer variable
zahlwith a value of your choice (e.g. B.8) — you have to here nothing read. - Check with that Modulo operator
%, whetherzahlis even: a number is even if it is The remainder when divided by 2 is 0 is. - ACT.
zahleven, give exactlygeradeoff, otherwise exactlyungerade. The branch (if/else) you write yourself.
The test checks that zahl is an integer and your output (gerade/ungerade) matches the parity of your value — no matter what value you choose. Example: zahl = 8 → gerade,
zahl = 7 → ungerade.
Part 3 — Your Code
Loading Python…Tests
Part 4 — Convert a grade into an assessment
if/elif/else with multiple branches.
Exercise
- Read a note as a whole number
int(input())there. - Translate the grade into the appropriate evaluation word (without umlauts) and print it out exactly like this:
1→sehr gut,2→gut,3→befriedigend,4→ausreichend,5→mangelhaft, otherwise (note6) →ungenuegend.
Use one for this if, several elif and a final one
else — you write the branches yourself.
Example: input 2 → exactly gut (not sehr gut — that would be grade 1); Input 6 → ungenuegend.
Part 4 — Your Code
Loading Python…Tests
Part 5 — Morning, Noon or Evening?
Multiple elif with overlapping Conditions - the order counts.
Exercise
- Read a time (full hour) as a whole number
int(input())there. - Is the time smaller than 12, give exactly
Morgenoutput; if it is less than 18, give exactlyMittagoff; otherwise give exactlyAbendout.
Include that if/elif/else around. Examples:
8 → Morgen, 14 → Mittag,
20 → Abend.
The order of the branches is crucial here: The test “less than 12” must before "smaller than 18". Otherwise, e.g. 8
(even smaller than 18) incorrectly Mittag — this is exactly the case that is being examined.
Part 5 — Your Code
Loading Python…Tests
Part 6 — Child, Adolescent or Adult?
Age groups with three branches.
Exercise
- Read an age as a whole number
int(input())there. - Is the age less than 13, give exactly
Kindoff; it is less than 18, give exactlyJugendlicheroff; otherwise give exactlyErwachsenerout.
Include that if/elif/else around. Examples:
8 → Kind, 16 → Jugendlicher,
40 → Erwachsener. Note the limit: 13 is already
Jugendlicher (no longer smaller than 13) — this case will also be checked.
Part 6 — Your Code
Loading Python…Tests
Report as PDF
Document and download your results.
Module overview
| Part | Status |
|---|---|
| Part 1: > 10? | Open |
| Part 2: Positive? | Open |
| Part 3: Even/Odd | Open |
| Part 4: Grades | Open |
| Part 5: Time of Day | Open |
| Part 6: Age group | Open |
Not all parts are completed yet - you can still create the report, which will then mark which parts are open.
Download PDF
Enter your name and download the report as a PDF.