Write a program that prompts for a file name, then opens that file and reads through the file DNSList.txt, looking for lines of the form: Location: France Count the number of DSN server from each country. Once you have accumulated the counts for each name, print out the counts, sorted by name. For example, enter a file name “DNSList.txt" or leave it blank and match the output below. Enter file:DNSList.txt DNS server list: Country Count Brazil 1 France 6 India 1 United
Write a program that prompts for a file name, then opens that file and reads through the file DNSList.txt, looking for lines of the form: Location: France Count the number of DSN server from each country. Once you have accumulated the counts for each name, print out the counts, sorted by name. For example, enter a file name “DNSList.txt" or leave it blank and match the output below. Enter file:DNSList.txt DNS server list: Country Count Brazil 1 France 6 India 1 United
Chapter8: Arrays
Section: Chapter Questions
Problem 8PE
Related questions
Question
Python
![Write a program that prompts for a file name, then opens that file and
reads through the file DNSList.txt, looking for lines of the form:
Location: France
Count the number of DSN server from each country. Once you have accumulated the
counts for each name, print out the counts, sorted by name.
For example, enter a file name "DNSList.txt" or leave it blank and match the output
below.
Enter file:DNSList.txt
DNS server list:
Country Count
Brazil
1
France
6.
India
1
United
5](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F6bd173dc-b595-47dd-9ed3-7eeb4e63db70%2Fdea7f70f-715a-4c2a-97a9-ff5d1da37023%2Fwdbp0de_processed.png&w=3840&q=75)
Transcribed Image Text:Write a program that prompts for a file name, then opens that file and
reads through the file DNSList.txt, looking for lines of the form:
Location: France
Count the number of DSN server from each country. Once you have accumulated the
counts for each name, print out the counts, sorted by name.
For example, enter a file name "DNSList.txt" or leave it blank and match the output
below.
Enter file:DNSList.txt
DNS server list:
Country Count
Brazil
1
France
6.
India
1
United
5
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning