I recently went over a lesson on
None; however, I am still not entirely clear on its functionality. Could anyone provide some examples for when I could expect to get
None as the result of running some code?
For example, I am not understanding why the code below would return
None both times…
print_return = print('Hello') #prints hello print(print_return) #prints None #but why!! should this not be the same as the line above?# sorted_this_list [5,7,3,2] list_sort_return = sort_this_list.sort() print(list_sort_return) #prints None #why does this not print the sorted list?
Also, this is somewhat unrelated, but how is it that
None is its own type?!
That is when I typed
print(type(None)) I got
<class 'NoneType> in the terminal!
Thanks in advance for considering my questions!