Variables
Programming task — enter your code and have it checked. Most parts
read their values with them input() a: the check feeds in fixed inputs and compares your output character by character — so give only what is required (no additional texts). At part 6 you define the values yourself (none
input()); There it is checked whether the variables are set and swapped correctly. Like
input() works, it says in the instructions.
Part 1 — Welcome
Read a name and greet.
Exercise
- Read a name
input()there. - Be specific
Hallo, <name>!off — when enteringAnnathereforeHallo, Anna!.
Part 1 — Your Code
Loading Python…Tests
Part 2 — Sum of two numbers
Read in two numbers and add them together.
Exercise
- Read two integers one - each with
int(input()). - Pass only their sum (e.g. B. at
3and4the number7).
Part 2 — Your Code
Loading Python…Tests
Part 3 — Age in Sentence
Read in a number and incorporate it into a sentence.
Exercise
- Read the age as a whole number (
int(input())). - Give the sentence
Ich bin X Jahre alt.from — where X is the read age.
Part 3 — Your Code
Loading Python…Tests
Part 4 — Multiple statements
Combine three entries into one sentence.
Exercise
- Read one at a time First name, Name and City one (three
input()). - Output exactly:
<vorname> <nachname> wohnt in <stadt>.
Part 4 — Your Code
Loading Python…Tests
Part 5 — Total price
Calculate with numbers read in.
Exercise
- Read that first Price as a decimal number (
float(input())), then the Number as an integer (int(input())). - Calculate the total price Price · Number.
- Round to 2 decimal places and give only the result from - e.g. B. at price
3.5and number4the number14.0.
You can use round or the decimal-place formatting of an f-string. Find out how to specify the required number of decimal places.
The checks accept trailing zeros: 14.0 and 14.00 count as the same numeric value. What matters is the correctly rounded value and the required output lines.
Part 5 — Your Code
Loading Python…Tests
Part 6 — Exchanging values
Swap two self-set values - here without input().
Exercise
This exercise will not read in: you set the values yourself. It's about that Exchange pattern to master.
- Set two variables
xandyand give to them different values (e.g. B.x = "rot"andy = "blau"). - Swap their contents: After the swap, in
xthe previous value ofyand vice versa (tip: via an auxiliary variable - or the multiple assignment from Python). - Give afterward
xin line 1 andyin line 2 out — atx = "rot"andy = "blau"so appearsblauand belowrot.
Part 6 — Your Code
Loading Python…Tests
Report as PDF
Document and download your results.
Module overview
| Part | Status |
|---|---|
| Part 1: Welcome | Open |
| Part 2: Total | Open |
| Part 3: Age | Open |
| Part 4: Multiple details | Open |
| Part 5: Total price | Open |
| Part 6: Swap | 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. The report contains your submitted code, the module overview and a QR code for verification.