Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
why type(t) is Nonetype?????
0
votes
asked
Jun 24, 2019
by
오찬솔
(
130
points)
def ley(x,y,gg=1):
print(gg)
if(gg%x==0)&(gg%y==0):
print(type(gg))
return gg
else:
gg+=1
ley(x,y,gg)
t=ley(2,3,1)
print(type(t))
qpython
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
2 Answers
0
votes
answered
Jun 28, 2019
by
krishna singh
Bcoz your function is non returning type hence its type(t) is none simply t=ley(2,3,1) will be treated as simply ley(2,3,1) and also function is of NoneType
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
+1
vote
answered
Jun 29, 2019
by
Big Al
Your popping out of your function in the "else" condition. Since you're not returning a value there you are getting the NoneType response.
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...