I have
b = heapify([5,4,9,1])
and if I do a
type(b)
It says it’s NoneType instead of list type, anyone know what I’m doing wrong??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
heapify()method transforms the list in-place. This means that it alters the list, but does not returned the modified list. As agf mentions below,heapify()returnsNoneto protect you from this mistake. Therefore, if you doyou will see that
lstis now heapified. See the library reference for more info.