HI Rajtilak,
As suggested, please see below for which I receive the error as follows even though the function gives correct output of -10
Function:
sum = 0
def special_func(num):
if num > 0 and type(num) == int:
i = 1
j = 0
fact = list()
while (i <= num):
if num == 1:
return 1
elif (num % i == 0):
fact.append(i)
if (i % 2 != 0):
sum = sum + i
i = i + 1
j = j + 1
print(i)
print(j)
else:
i = i + 1
return sum
elif (num < 0) or (type(num) != int):
return -10
special_func(6.5)
Output I received:
-10
Since the number is not an int and supplied number is a float we return -10 as the output as outlined in the question.
Assessment output message after submitting the code:
You should return -10 in case of non int type
I get the above message when I submit the code for all of the questions. So please clarify and ensure that the assessment is complete for all of the code submitted. Thanks for your help.