Write a function (python3) named depends_on_the_type() that takes in a single parameter obj short for object. The function will work on the data types
- boolean,
- str,
- float,
- int
What is returned depends on the data type of the object:
If the obj is an int:
- The function will return 'Zero' if obj == 0
- The function will return the square of that integer if it is even
- The function will return the cube of that integer if it is odd
If the obj is a float, the function will return the number multiplied by 1.5
If the obj is a str, the function will return the string concatenated with itself
If the obj is a bool, return the negation of that boolean
If the obj is not one of the above data types, return None
attempt:
def depends_on_the_type(obj):
if obj == class(int):
if obj == 0:
return 'Zero'
elif obj % 2 == 0:
return obj**2
elif obj % 2 == 1:
return obj**3
if obj == class(float):
return obj*1.5
if obj == class(str):
return str(obj)
if obj == class(bool):
return not bool
else:
return None