Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (2016, retired 2019) Lists Removing Items From A List

can you please help me what is the use of keys. "None" and "pass " can you please elaborate with example

thanks in advance

2 Answers

None refers to a null value. It's Python's way of saying "nothing." It sounds useless, but it actually can be useful in some case, e.g. you might have a set of numbers, but some are still unknown.

pass, on the other hand, represents that there is currently no body of code in a block. If you are simply building out the heading of a bunch of functions, for instance, but you don't want to write any body yet you want the program to still run, you could use pass:

# Intention: to create an empty function

# Confuses Python; causes an error
def my_empty_function():

# Python now understands that the body is empty
def my_empty_function():
    pass

pass isn't used very often, and you almost never see it in completed code (it is mainly used in testing), but occasionally you see code with it so it still is good to know.

thank you very much Alexander Davison