We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dee973d commit 422b859Copy full SHA for 422b859
1 file changed
900-Cheatsheet.md
@@ -104,6 +104,27 @@ text = 'Wie geht\'s?'
104
erzählung = "Sie sagt: \"So geht das!\""
105
neue_zeile = "Zeile 1\nZeile 2"
106
tabulator = "Text\teingerückt\n\tauch eingerückt"
107
+
108
+```
109
+## Besondere Python-String
110
111
+### f-String = Formatierte String
112
+```python
113
+# Variablen für die nachfolgenden Beispiele.
114
+name = "Alice"
115
+alter = 25
116
+kontostand = 14
117
118
+# Variablen in Strings einfügen
119
+print(f"Hallo, ich bin {name}!") # Hallo, ich bin Alice!
120
+print(f"Ich bin {name} und {alter} Jahre alt") # Ich bin Alice und 25 Jahre alt
121
122
+# Ausdrücke in f-Strings
123
+a = 17
124
+b = 5
125
+print(f"{a} geteilt durch {b} ist {a//b} mit Rest {a%b}.")
126
+# 17 geteilt durch 5 ist 3 mit Rest 2.
127
128
```
129
130
## Boolesche Werte
0 commit comments