Created
August 7, 2020 20:55
-
-
Save mayankdawar/ca549f2228ca109dfbfafa25816e8d27 to your computer and use it in GitHub Desktop.
Given below is a list of lists of athletes. Create a list, t, that saves only the athlete’s name if it contains the letter “t”. If it does not contain the letter “t”, save the athlete name into list other.
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
t = [] | |
other = [] | |
athletes = [['Phelps', 'Lochte', 'Schooling', 'Ledecky', 'Franklin'], ['Felix', 'Bolt', 'Gardner', 'Eaton'], ['Biles', 'Douglas', 'Hamm', 'Raisman', 'Mikulak', 'Dalton']] | |
for lst in athletes: | |
for name in lst: | |
if 't' in name: | |
t.append(name) | |
else: | |
other.append(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment