Demoprogramme

This commit is contained in:
2024-02-02 13:47:29 +01:00
parent 3963f98baa
commit e2676beee0
4 changed files with 72 additions and 0 deletions

11
teil24/match_structure.py Normal file
View File

@@ -0,0 +1,11 @@
values= ['John']
# Matching structure in Python switch-case
match values:
case [a]:
print(f'Only one item: {a}')
case [a, b]:
print(f'Two items: {a}, {b}')
case [a, b, c]:
print(f'Three items: {a}, {b}, and {c}')
case [a, b, c, *rest]:
print(f'More than three items: {a}, {b}, {c}, as well as: {rest}')