Ad
Fundamentals
Logic
Code
Diff
  • identify_data_type = lambda value: type(value).__name__
    • def identify_data_type(value):
    • if value is None:
    • return 'unknown'
    • data_type = type(value).__name__
    • if data_type == 'int':
    • return 'int'
    • elif data_type == 'float':
    • return 'float'
    • elif data_type == 'str':
    • return 'str'
    • elif data_type == 'list':
    • return 'list'
    • elif data_type == 'tuple':
    • return 'tuple'
    • elif data_type == 'dict':
    • return 'dict'
    • elif data_type == 'bool':
    • return 'bool'
    • elif data_type == 'set':
    • return 'set'
    • elif data_type == 'function':
    • return 'function'
    • else:
    • return 'unknown'
    • identify_data_type = lambda value: type(value).__name__