Python - noteringar under tenta-plugg

The exercise was created 2026-06-04 by SaraEricssonLTH. Question count: 3.




Select questions (3)

Normally, all words in an exercise is used when performing the test and playing the games. You can choose to include only a subset of the words. This setting affects both the regular test, the games, and the printable tests.

All None

  • Om man ska returnera en sträng men behöver iterera över flera värden, exempelvis flera maträtter. Hur bör man göra då? output = " ", for x in self.X, output += f'{x} \n', return output
  • Om något inte har index, dvs är icke-subscriptable, hur kan man då iterera över det då? Genom en for-sats: x in icke-subscriptable (ex. mängd)
  • Hur skapar man smidigast en matris i python som ska innehålla en specifik typ av variabel? (rows motsvarar antal rader (horisontellt) och cols antal kolumner (vertikalt)) skapa tom lista, for i in range(rows):, lista.append([typ] * cols)

All None

Shared exercise

https://spellic.com/eng/exercise/python-noteringar-under-tenta-plugg.12996152.html