Skip to content

Instantly share code, notes, and snippets.

@zhongleqi
Last active January 23, 2023 21:21
Show Gist options
  • Save zhongleqi/8779687391320bf5534386b9f6a043f0 to your computer and use it in GitHub Desktop.
Save zhongleqi/8779687391320bf5534386b9f6a043f0 to your computer and use it in GitHub Desktop.
Leqi Zhong, Programming in Journalism, Assignment 1. Jan. 23, 2023
animals = ['cat', 'dog', 'canary', 'chihuahua', 'narwhal']
filtered_animals = []
number = 0
for animal in animals:
if (animal[0]) == "c":
filtered_animals.append(animal.upper())
number = number + 1
print(filtered_animals, "Number of C-animals: ", number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment