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. There are two types of exercises: For most you read values input() a — the check feeds in fixed inputs and compares your output character by character, so give only what is required. The input prompt (input("…")) hides the exam, so it doesn't bother you. For the remaining exercises (part 1 and part 6) you define the values yourself in the code — there will be input() not needed and the check looks at your variables directly.

Part 1 — Block runs exactly once

The simplest do-while case: a block that runs once.

Exercise

  1. Create a variable yourself wort with any text (string) - this is where you read nothing there.
  2. Build a do-while structure that wort exactly once outputs and then ends. Python doesn't know do-while: you start an endless loop, type in the block wort and breaks off the loop again in the same run.

This is about the construct itself: the block should exactly once run. Give wort only once.

Part 1 — Your Code

Loading Python…
Output

    

Part 2 — Counting up to a target value

The condition is at the end of the block - the block also runs when n = 1.

Exercise

  1. Read a target value as an integer (int(input())); the target value applies ≥ 1.
  2. Start with a counter with the value 1 and print it on a separate line in each iteration of the loop.
  3. Test at the end of the block whether the counter has reached the target value (counter ≥ Target value): If yes, end the loop, otherwise increase the counter by 1 and continue.

The lines appear at target value 4 1, 2, 3, 4; with target value 1 only the line 1.

Part 2 — Your Code

Loading Python…
Output

    

Part 3 — Read until “ok” is entered

Real input check: read first, then cancel at the end.

Exercise

  1. Read a word in a do-while loop (i.e. an endless loop with termination at the end of the block). input() and output it immediately on a separate line.
  2. Test then (at the end of the block): is the word exactly ok, end the loop — otherwise read the next word.

Even if it's the first word ok is, it is read once and output. Input test, ok So results in the lines test and ok.

Part 3 — Your Code

Loading Python…
Output

    

Part 4 — Collect points up to the threshold

Add up the values and check against a limit at the end of the block.

Exercise

  1. Read one first Threshold as an integer (int(input())).
  2. Start with a score of 0. Read one at a time in a do-while loop Growth a (int(input())), add it to the score and give the new one Points on its own line.
  3. Test then (at the end of the block): the score has reached the threshold (score ≥ Threshold), end the loop — otherwise read the next increment.

At threshold 3 and the increases 1, 1, 1 the lines appear 1, 2, 3. Even at threshold 0 If the block runs once: an increase 5 results in the line 5.

Part 4 — Your Code

Loading Python…
Output

    

Part 5 — Mini menu until “end”

Read the selection, react, and at the end check for cancellation.

Exercise

  1. In a do-while loop, read one Selection as an integer (int(input())).
  2. Is the selection 1, give exactly Start and read the next selection.
  3. Is the selection 2, give exactly Ende and then end the loop.

Will be immediately 2 entered, only appears Ende — the block still runs once. Input 1, 2 yields Start and below Ende.

Part 5 — Your Code

Loading Python…
Output

    

Part 6 — Password-experiments count

Run over a self-defined list - end at the correct password.

Exercise

  1. Create your own list eingaben using password attempts (strings) — this last Element must 1234 with any incorrect attempts before it. In this task, do nothing with input() there.
  2. Iterate over the list using while True:. In each iteration, process the next entry first, then check whether it is exactly "1234" . Exit the loop at the first match using break.
  3. Count every checked entry, including the correct password. You may use a counter or a list index. An index starts at 0, so the number of checked entries is one greater than the index.
  4. Print exactly one number: the number of attempts up to and including "1234". You may print this immediately before break or after the loop. Do not print anything else.

Standing 1234 already in the first place, is the output 1 (the block still runs once). At ["0000", "1234"] is the output 2.

For ["2222", "1111", "3333", "1234"] the output is 4. The search is for the exact string "1234" rather than the number 1234 or part of a longer password.

Part 6 — Your Code

Loading Python…
Output

    

Report as PDF

Document and download your results.

Module overview

PartStatus
Part 1: Produce output onceOpen
Part 2: Counting up to nOpen
Part 3: Read until “ok”Open
Part 4: Collect pointsOpen
Part 5: Menu to endOpen
Part 6: Password-experimentsOpen

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.