logo CodeStepByStep logo


Language/Type: Python file input

Write a function named plus_scores that accepts an input file name as a parameter. The input file contains a series of lines that represent student records. Each student record takes up two lines of input. The first line has the student's name and the second line has a series of plus and minus characters. Below is a sample input file:

Kane, Erica
Chandler, Adam
Martin, Jake
Dillon, Amanda

For each student you should produce a line of output with the student's name followed by a colon followed by the percent of plus characters. For the input above, your function should produce the following output:

Kane, Erica: 40.0% plus
Chandler, Adam: 75.0% plus
Martin, Jake: 100.0% plus
Dillon, Amanda: 62.5% plus
Type your Python solution code here:

This is a function exercise. Write a Python function as described. Do not write a complete program; just the function(s) above.

You must log in before you can solve this problem.

Log In

Need help?

If you do not understand how to solve an exercise or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect tests, etc.), please

Is there a problem? Contact a site administrator.

©, all rights reserved.