Alle Dateien aus dem Pythonkurs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

11 lines
351 B

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}')