The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

Python Exercise – Notable built in functions

Python Exercise – Notable built in functions

Super Learner

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)
      print(“Not Possible”)

1 Answer

365 Team

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.


Looking forward to your reply.
Hope this helps.

Thanks Martin! It works. I don’t know why it wasn’t working at that time

4 months

Hi Archisman! Great! Thank you for letting us know! Good luck and please feel free to post another question should you encounter any difficulties. Thank you.

3 months