16. Lektion: Funktionen.extend(): Difference between revisions

From Attraktor Wiki
Jump to navigation Jump to search
Line 16: Line 16:
<pre>
<pre>
>>> def test2(a, b):
>>> def test2(a, b):
    return (a, b)
        return (a, b)


>>> z = test2(3.14, 42)
>>> z = test2(3.14, 42)

Revision as of 17:00, 1 October 2023

Funktionen

Mehrere Ergebnisse zurückgeben

>>> def test1(a, b):
        return a, b

>>> x, y = test1(3.14, 42)
>>> x
3.14
>>> y
42
>>> 

Alternative:

>>> def test2(a, b):
        return (a, b)

>>> z = test2(3.14, 42)
>>> z
(3.14, 42)
>>> x, y = z
>>> x
3.14
>>> y
42
>>> 

Positions- oder Schlüsselwortargumente

Zufallszahlen


Navigation

Zurück zu Micropython Kurs 2023 - Teil 1
Zurück zur "Micropython Kurs 2023" Startseite
Zurück zur Programmieren Startseite
Zurück zur Wiki Startseite