Using sort()


#1

https://www.codecademy.com/en/courses/learn-python/lessons/python-lists-and-dictionaries/exercises/its-dangerous-to-go-alone-take-this

when I tried to print

inventory[ ‘backpack’].sort()

Its return None, is this correct to use sort function with list value?


14. It's Dangerous to Go Alone! Take This
#2

Hi @khamism,

You displayed the returned value of the .sort() method, which is None.

First, call .sort() on inventory[‘backpack’], then print it, separately.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.