Resolved: Python Exercise - Notable built in functions
I am using the following code. Everything works except for the part where I printing "Cat" and the program should give me an Output of "Not Possible" but it is giving an error.
def distance_from_zero(x):
if(type(x)== int() or type(x)==float()):
return abs(x)
else:
print("Not Possible")
if(type(x)== int() or type(x)==float()):
return abs(x)
else:
print("Not Possible")
1 answers ( 0 marked as helpful)
Hi Archisman!
Thanks for reaching out.
Can you please support your question with the code you've executed, as well as with a screenshot containing the entire error message? Only then will we be able to provide a specific answer. Thank you.
Currently, I ran your code and then executed the function with an argument of "Cat", and did indeed obtain "Not Possible" as an answer.
Best,
Martin
distance_from_zero("Cat")Looking forward to your reply. Hope this helps.
Best,
Martin