Notes:
Sorting and searching
Let’s try something a little more practical, such as manipulating data and using files. For this experiment, you need to use a text window in IDLE to create a list of film names. Type the film names as shown here into the editor and save it as “ filmlist ”.
Inception (2010) Source Code (2011) Avatar (2009) The Simpsons Movie (2007) X-Men Origins: Wolverine (2009) Rango (2011) The Green Hornet (2011) Grown Ups (2010)
Harry Potter and the Deathly Hallows: Part 1 (2010) Harry Potter and the Deathly Hallows: Part 2 (2011) Star Trek (2009)
Spider-Man 3 (2007) Transformers (2007) Shrek the Third (2007) Kung Fu Panda (2008) Mamma Mia! (2008) Quantum of Solace (2008) WALL-E (2008) The Dark Knight (2008) Up (2009) The Twilight Saga: New Moon (2009) Sherlock Holmes (2009) Toy Story 3 (2010) Despicable Me (2010) How to Train Your Dragon (2010)
Now, let’s write some code to sort these films into order by release date.
Experiments in Python
91
Made with FlippingBook flipbook maker