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: has . then:

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!