Question: Python Question. txt transcript at the bottom. Open the txt file. Parse each line of the file. If the line starts with #, then ignore
Python Question. txt transcript at the bottom.
Open the txt file. Parse each line of the file. If the line starts with #, then ignore it. Remember to import re. If the line has this organization:
1. Add the number to the dictionary people[name].
2. Add the number to the dictionary animalcounter[animaltype]
After parsing the file print the following:
1. Print the names of all people with pets. DO NOT print duplicates..
For example, "Amanda has 6 dogs."
2. Print the number of pets per animal type.
For example, "There are 12 cats."
Here is the txt transcript:
#IGNORE THIS LINE
Patty has 6 cats.
Dawn has 4 dogs.
Drew has 1 elephant.
Penelope has 12 birds.
Casey has 1 dog.
John has 2 cats.
Jake has 5 dogs.
Chan has 1 giraffe.
#IGNORE THIS LINE TOO
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
