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.
24 lines
531 B
24 lines
531 B
10 months ago
|
#encoding:utf-8
|
||
|
def print_type(value):
|
||
|
match value:
|
||
|
case int():
|
||
|
print('Integer')
|
||
|
case str():
|
||
|
print('String')
|
||
|
case list():
|
||
|
print('Liste')
|
||
|
case dict() as d:
|
||
|
print(f'Dictionary mit {len(d)} Einträgen')
|
||
|
case _:
|
||
|
print('unbekannter Datentyp')
|
||
|
|
||
|
print_type(1) #Integer
|
||
|
|
||
|
print_type('The Simpsons') # String
|
||
|
|
||
|
print_type([1, 2, 3]) # Liste
|
||
|
|
||
|
print_type({'a': 1, 'b': 2, 'c': 3}) # Dictionary
|
||
|
|
||
|
print_type(1.0) #float ist nicht implentiert
|