Basics Flashcards
(28 cards)
Eine Funktion um eine Ausgabe im terminal zu erzeugen
Ausgabe im terminal mit variabeln
Print(f”{x}”)
Syntax
Gibt vor welche Befehle u Ausdrücke gültig sind
Gibt vor welche Bedeutung Befehle bzw Ausdrücke haben
Semantik
Datentyp ausgeben
Print(type(x))
Ganze zahl
Int
Gleitkommazahl
Float
Text
Str
Wahrheitswert
Bool
Kein typ
None
Typumwandlung
Str() int()
In tupel liste set wörterbuch ganze zahl hexadezimal string umwamdeln
Tupel(x) list() etc.
Speichert eine Liste
List [1,2,3]
Speichert eine unveränderbare liste
(1,2,3)
Speichert Daten Schlüssel paare
Dictionary {“Name”:”kevin”,”nm”:1234}
Potenz
**
Ganz zahl division
//
Rest der division
10%2
Zufalls zahl
From random Import Ranking
random.randint(a,b)
Vergleichsoperatoren: gleich, ungleich,das selbe , nicht das selbe
== != is is not
Entweder entweder oder
If Bedingung:
Aktion
Elif:
Aktion
Else:
Aktion
Boolesvhe Operatoren
Not x ist true wenn x==false
X and y ist true wenn x==true und y== true
X or y ist true wenn x==true oder y== true
Schleife solange Bedingung wahr
X=10
White x>0:
X-=1
Print(feiert von x: {x}”)
Schleife mit fest vorgegeben interationen
For Element in elements:
Aktion
pass