English translation

This is going to be a very short task. You will need to write only a single line for each function. Actually, it's going to be shorter than you'd desire: each function will have to consist of only a single line.

We're returning back to the task we've already solved twice: the first time it was called Šikaniranje, and the second time it was Funkcijske ovire.

This time, we'll solve it using list comprehension. If it helps (it should, at least a little) test already include solutions ... just with too many lines. :)

Mandatory task

Write functions

  • stevilo_ovir(ovire),
  • dolzina_ovir(ovire),
  • sirina(ovire),
  • dodaj_vrstico(bloki, y)
  • globina(ovire, x)
  • senca(ovire)

so that they will consist of a single return statement.

Non-mandatory task

Write a function indeksi(s, subs), which gets two strings s and subs and returs a list of indices within s, at which one can find subs. Call indeksi("pepelka peče prepelice", "pe") returns [0, 2, 8, 16], because pe appears at indices 0, 2, 8 and 16. This function must of course also consist only of return statement.

Then, write a one-line function

  • pretvori_vrstico(vrstica).

Extra extra task (doesn't count for anything)

Write the remaining two functions:

Zadnja sprememba: torek, 29. november 2022, 21.48