Want to know what the value is in Python type judgment?

is learning Python, in codeacademy. An example that mentions built-in function type () , want to know what are the int and float of type () in the following example? Because type () prints out the result of < type "str" > . So does that mean it"s not str, or anything else? Or is it just pure type judgment?

def distance_from_zero(number):
  if type(number) == int or type(number) == float:
    return abs(number)
  else:
    return "Nope"
Mar.11,2021

type returns the built-in type Type Object , which represents the type of an object.

refer to python.org/2.7/library/stdtypes.html-sharptype-objects" rel=" nofollow noreferrer "> python documentation

Menu