In python, read the file credit_cards.txt into a dictionary with the count of how many cards...

70.2K

Verified Solution

Question

Programming

In python, read the file credit_cards.txt into a dictionary withthe count of how many cards of each type of card are in thefile.

credit_cards.txt contains the following data:

John Smith, Discover

Helen Jones, Visa

Jerry Jones, Master Card

Julio Jones, Diners Club

Fred Jones, Diners Club

Anthony Rendon, Platinum Visa

Juan Soto, Platinum Visa

George Jones, American Express

Brandon Allen, Visa

Henry Beureguard, Visa

Allen Jackson, Master Card

Faith Hill, Platinum Visa

David Smith, Master Card

Samual Jackson, Visa

Donny Jackson, Master Card

Herb Smith, Visa

Ryan Day, American Express

Herm Edwards, American Express

Daisey Fuentes, Master Card

Henry Flood, Visa

Answer & Explanation Solved by verified expert
4.2 Ratings (494 Votes)
Program Code toCopyfile opencreditcardstxt rcreditcards cleanlines for i in file Filtering out lines that are emptyif line is not blank we take it into another listcleanlines if i n    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students