Created
August 1, 2018 11:11
-
-
Save stephaniemdavis/e224c77d110ecc297505fb325aae9129 to your computer and use it in GitHub Desktop.
List comprehension, string operation; danger of NoneType assignment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stephanie M. Davis. 8-1-2018 in Washington D.C. for NASA showcase event | |
# Just practicing list comprehensions. In the process, I FINALLY learned the futuility of assigning a NoneType method to a variable | |
# Build a list of the 12 months and build a new list of those months beginning with the letter 'A' | |
months = ['January','February','March','April','May','June','July','August','September','October','November','December'] | |
a_months = [month for month in months if month.starswith('A')] | |
# just for laughs apply reverse method to a_months and assign to variable none_type and see what happens | |
none_type = a_months.reverse() | |
none_type |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment