Python - Función Type
#48 ejemplos utilizando la función type en Python:
#1. devuelve <class 'int'>
print(type(5))
#2. devuelve <class 'float'>
print(type(5.0))
#3. devuelve <class 'str'>
print(type('Hola'))
print(type("Hola"))
#4. devuelve <class 'bool'>
print(type(True))
#5. devuelve <class 'bool'>
print(type(False))
#6. devuelve <class 'list'>
print(type([1, 2, 3]))
#7. devuelve <class 'tuple'>
print(type((1, 2, 3)))
#8. devuelve <class 'dict'>
print(type({1:'uno', 2:'dos'})
#9. devuelve <class 'set'>
print(type({1, 2, 3}))
#10. devuelve <class 'complex'>
print(type(2+3j))
#11. devuelve <class 'range'>
print(type(range(5)))
#12. devuelve <class 'bytes'>
print(type(b'Hola'))
#13. devuelve <class 'bytearray'>
print(type(bytearray(5)))
#14. devuelve <class 'memoryview'>
print(type(memoryview(b'Hola')))
print(type(memoryview(b"Hello")))
#15. devuelve <class 'NoneType'>
print(type(None))
#16. devuelve <class 'builtin_function_or_method'>
print(type(abs))
#17. devuelve <class 'builtin_function_or_method'>
print(type(len))
#18. devuelve <class 'function'>
print(type(lambda x: x+1))
#19. devuelve <class 'generator'>
print(type((x for x in range(5))))
#20. devuelve <class 'list_iterator'>
print(type(iter([1, 2, 3])))
#21. devuelve <class 'type'>
print(type(int))
#22. devuelve <class 'type'>
print(type(float))
#23. devuelve <class 'type'>
print(type(str))
#24. devuelve <class 'type'>
print(type(bool))
#25. devuelve <class 'type'>
print(type(list))
#26. devuelve <class 'type'>
print(type(tuple))
#27. devuelve <class 'type'>
print(type(dict))
#28. devuelve <class 'type'>
print(type(set))
#29. devuelve <class 'type'>
print(type(complex))
#30. devuelve <class 'type'>
print(type(range))
#31. devuelve <class 'zip'>
print(type(zip([1,2,3],[4,5,6])))
#32. devuelve <class 'set'>
print(type(set([1,2,3])))
#33. devuelve <class 'frozenset'>
print(type(frozenset([1,2,3])))
#34. devuelve <class 'bytes'>
print(type(bytes(5)))
#35. devuelve <class 'str'>
print(type(chr(65)))
#36. devuelve <class 'int'>
print(type(ord("A")))
#37. devuelve <class 'str'>
print(type(hex(255)))
#38. devuelve <class 'str'>
print(type(oct(255)))
#39. devuelve <class 'str'>
print(type(bin(255)))
#40. devuelve <class 'int'>
print(type(abs(-5)))
#41. devuelve <class 'int'>
print(type(round(5.6)))
#42. devuelve <class 'int'>
print(type(pow(2,3)))
#43. devuelve <class 'int'>
print(type(max([1,2,3])))
#44. devuelve <class 'int'>
print(type(min([1,2,3])))
#45. devuelve <class 'int'>
print(type(sum([1,2,3])))
#46. devuelve <class 'int'>
print(type(len("Hola")))
#47. devuelve <class 'bool'>
print(type(isinstance("Hola", str)))
#48. devuelve <class 'bool'>
print(type(issubclass(str, object)))