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.

Module 1 — What is a List?

An ordered collection of values.

Definition

One List stores multiple values under a single variable. The values are in [ … ], separated by commas. A list can hold any type — numbers, strings, even other lists.

Syntax:

farben = ["rot", "blau", "gruen"]
zahlen = [1, 2, 3, 4]
gemischt = ["Anna", 7, True]

The order is preserved - unlike a set (set). With len(liste) you get the number of elements.

Example 1.1 — Creating and outputting a list

Loading Python…
Output

    

Module 2 — Index access

Read individual elements — front and back.

Counting from 0

Every element in a list has one Index. The counting starts at 0:

  • liste[0] — first element
  • liste[1] — second element
  • liste[-1] — last element
  • liste[-2] — penultimate element

If you access an index that doesn't exist, an error occurs IndexError.

Example 2.1 — grab at the front

Loading Python…
Output

    

Example 2.2 — access from behind

Loading Python…
Output

    

Module 3 — Modify and append elements

Lists are changeable.

Overwrite element

With an assignment to an index replaced you the element at this point. The list length does not change.

namen = ["Anna", "Ben", "Clara"]
namen[1] = "Tom"   # Ben → Tom

Example 3.1 — replace second entry

Loading Python…
Output

    

Attach with append()

The method liste.append(wert) hangs a new value to the end on. This makes the list one longer.

tiere = ["Hund", "Katze", "Maus"]
tiere.append("Vogel")

Example 3.2 — Append element to end

Loading Python…
Output

    

Module 4 — Calculating with lists

Link values from the list.

Combine multiple elements

You can access several elements of a list via their indices and e.g. B. sum or compare.

zahlen = [5, 10, 15, 20]
summe = zahlen[0] + zahlen[1] + zahlen[2]

Example 4.1 — sum the first three values

Loading Python…
Output

    

TipRules of Procedure

  • You write an empty list as [].
  • With len(liste) you get the number of elements.
  • With liste[-1] you reach always the last element — no matter how long the list is.
  • Negative indices count from behind: liste[-2] is the penultimate element.

There are two types of parts in the programming tasks: The Place-exercises You create the list yourself (you choose the values) - you don't need one here input(). At the Calculator-exercises your program reads the values input() a (known from the “Variables” module); the check feeds in the entries automatically.

Sources & further literature

Where the knowledge imparted here is officially documented.

Official Python documentation

Tutorials & Manuals

  • Real Python — Lists and Tuples in Python: realpython.com/python-lists-tuples
  • Theis, Thomas: Getting started with Python. 7. Edition, Rheinwerk Verlag, 2023 — Chapters on lists.
  • Klein, Bernd: Introduction to Python 3. 4. Edition, Hanser Verlag, 2021 — “Lists” section.