Not accepting the code despite of giving right output

Hi, Soumyadeep.

Can you kindly check your function as you need to pass some argument to the function to get the result.
You are writing the input in try block, then how the num will take the value initially when called?

All the best!