Skip to content

Commit 7d1fa6e

Browse files
committed
Dictionaries: Zugriff auf nicht vorhandene Elemente
1 parent 1e5578a commit 7d1fa6e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Level_03/dictionaries.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# Auf einen value wird mit Hilfe des keys zu-
1717
# gegriffen:
1818
print(dictionary["Eins"])
19+
# dictionary["nicht da"]: schlägt fehl
20+
dictionary.get("nicht da")
1921

2022
# Ein neues Key-Value-Paar wird erstellt,
2123
# indem auf ein nicht-existierenden value zu-

0 commit comments

Comments
 (0)