Question: using python The last program will take in the name of a file from the user and calculate some basic information about it, before printing

using python The last program will take in the name of ausing python

The last program will take in the name of a file from the user and calculate some basic information about it, before printing out all of the information and calculated details to the user.

For this part of the homework, you can assume that the filename provided will be valid, and that the data inside will be well-formatted (i.e., free of errors). Each line of the file will use the following format:

 Dog Breed Name,numBorn,numAdopted 

The dog breed name is guaranteed to be no more than 22 letters, and the numbers are guaranteed to be no higher than 9999 (four digits).

The information printed out to the screen must be the dog breed name, the number of dogs adopted, the number of dogs born, and the percentage of dogs adopted from those born. There must also be column headings printed at the top of the list. (See the sample output for an example.)

To make the task a bit simpler, you are allowed to use magic numbers, butonly when formatting a string. Other numbers (like which position the breed name is stored in, for example), must be made into constants.

Please enter the name of the file to open: hw6 dogs.txt Adopted / Born -- Percentage 305 /372 138 /438 1918 784 /815 127 /324 76/ 264 178 /200 47/74 41 / 297 355 /685 148 / 438 155 /224 183 / 228 96/ 204 58 /68 447 /623 197 /371 85/314 74 /192 76 /85 81 . 99% 31 . 51% 100.00% 96. 20% 39 . 20% 28 . 79% 89. 00% 63. 51% 13 . 80% 51 . 82% 33. 79% 69 . 20% 80.26% 4706% 85 . 29% 71. 75% 53. 10% 27.07% 38 . 54% 89 . 41% 94 . 92% 28. 74% 46 . 90% 42. 35% 72 . 83% 0?00% Ches. Bay Retriever. .. -- 1918 / ?? French Brittany. . . . -- Maremma Sheepdog Utonagan. . 50 / 174 303 /646 227 / 536 670920 0/35

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!