Save / load workspace

Save your lab results on this server for 48 hours. Use the token to continue on another device. Anyone who knows the token can open your workspace.

Save workspace

A name is required when you first save and is then permanently bound to this workspace. Task values, entries and progress are saved together.

Load workspace

New workspace

Start with empty results and a name of your choice. Previously saved tokens remain valid until they expire. Unsaved changes in this tab will be discarded.

Saving also transfers any included measurement files and analysis videos to this server. Running simulations are saved as a set of results and displayed in a paused state when loaded.

Programming task — enter your code and have it checked. Most parts read values input() a; the check then feeds fixed inputs and compares your output character by character — give there only what is required (no additional texts). You read two parts (3 and 6). not but define the function and choose the values to try it out yourself; There the runner checks the function directly. Like input() works, is stated in the instructions and in the “Variables” module.

Part 1 — Count to n

function with while-Loop and return.

Exercise

Lis n as an integer int(input()) there.

  1. Write a function above zaehle_bis(n) that come with one while-Loop a text of the numbers 1 to n builds up - the numbers depending on a Space separated — and returns the result.
  2. Call the function with the read in n and output its return value.
  3. For n = 3 the output is exactly 1 2 3 — no spaces at the beginning or end, no additional text.

Part 1 — Your Code

Loading Python…
Output

    

Part 2 — Even/Odd

for-Loop through a list, using if decide.

Exercise

Read the number first n with int(input()) one and then in a loop the n Numbers - one of each int(input()) — into a list zahlen.

  1. Write a function pruefe_zahlen(zahlen) that come with one for-Loop checks each number to see if it is even is (remainder 0 when divided by 2), and puts a suitable text in a result list for each number: for an even number <zahl> ist gerade, otherwise <zahl> ist ungerade (with the respective number instead <zahl>). Return the list.
  2. In the main block: call function and each Output the text of the return list on a separate line.
  3. Example: input 4, then 1 2 3 4 results in four lines 1 ist ungerade / 2 ist gerade / 3 ist ungerade / 4 ist gerade.

Part 2 — Your Code

Loading Python…
Output

    

Part 3 — Welcome

if/else within a function - here the function itself is the focus.

Exercise

Here will nothing read in: You define the function and choose the values to try out yourself. The runner then checks the function directly.

  1. Write a function begruessung(alter): That's it alter under 18, it should return the text Hallo Kind return, otherwise Hallo Erwachsener. Exactly 18 is already considered an adult.
  2. Call the function in the block if __name__ == "__main__": twice twice: once with an age below 18 and once with an age of at least 18. Output both return values.
  3. This is how you make both branches visible: once Hallo Kind, once Hallo Erwachsener.

Part 3 — Your Code

Loading Python…
Output

    

Part 4 — Sum to n

Accumulator in a function with return.

Exercise

Lis n as an integer int(input()) there.

  1. Write a function summe_bis(n) that come with one while-Loop the sum of all numbers from 1 to n added up and returns the result.
  2. Call the function with the read in n up and give only the number returned.
  3. For n = 5 is the output 15, at n = 10 then 55.

Part 4 — Your Code

Loading Python…
Output

    

Part 5 — Evaluate grades

for-loop + if/elif within a function.

Exercise

Read the number first n with int(input()) one and then in a loop the n Notes — one each int(input()) — into a list noten.

  1. Write a function zeige_noten(noten) that come with one for-loop and if/elif translates each note into exactly this text and returns the texts as a list: 1 → sehr gut, 2 → gut, 3 → befriedigend, 4 → ausreichend, everything else (e.g. 5) → nicht bestanden.
  2. In the main block: call function and each Output the text of the return list on a separate line.
  3. Example: input 3, then 1 3 5 results in the three lines sehr gut / befriedigend / nicht bestanden. Pay attention to the exact spelling of the texts.

Part 5 — Your Code

Loading Python…
Output

    

Part 6 — Login with three attempts

Function with two return values — the focus here is on the tuple return.

Exercise

Here too nothing read in: You define the function and choose the passwords to try it out yourself. The runner then checks the function directly.

  1. Write a function login_test(passwort) with one while loop for a maximum of 3 attempts. The attempt number starts at 1. If the password matches "1234" match, the function should two Return values: the text Login ok and the current attempt number. If the password is still incorrect after 3 iterations, the function returns the text Falsches Passwort together with the number 3 back.
  2. Call the function in the main block twice on — once with "1234", once with a wrong password — and unpack it two Returns in each case text and anzahl_versuche.
  3. Give each first text (line 1), then anzahl_versuche (line 2). With "1234" appears Login ok / 1, with an incorrect password Falsches Passwort / 3.

Note: The password is passed here once as a parameter (no input() per experiment). The whileThe loop therefore primarily demonstrates incrementing the attempt counter and returning early when the login succeeds. Tip: In Python, a function can return multiple comma-separated values.

Part 6 — Your Code

Loading Python…
Output

    

Part 7 — Using square multiple times

Call the same function for multiple values.

Exercise

Read three whole numbers one after the other a, b and c one — one each int(input()).

  1. Write a function quadrat(zahl), which returns the square of its argument — i.e number multiplied by itself.
  2. Call the function for each of the three numbers and output the three squares — each on its own line, in the order in which it was entered.
  3. Example: input 2, 5, 8 results in the three lines 4 / 25 / 64.

Part 7 — Your Code

Loading Python…
Output

    

Report as PDF

Document and download your results.

Module overview

PartStatus
Part 1: Count to nOpen
Part 2: Even/OddOpen
Part 3: WelcomeOpen
Part 4: Sum to nOpen
Part 5: NotesOpen
Part 6: LoginOpen
Part 7: SquareOpen

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.