Write a Python code that gets a file name from a user using the input
statement and reads it to obtain information about students. Each line of the file
includes information about a different student and has two items separated by a
space character. A file, grades.dat, that includes the names and grades of 10
students as shown below is given as an example. The first item is the student name
and the second item is the grade of that student. The code will read the information
in the file in a dictionary where student names are keys and their grades are values
using a for loop. The second item in each line that represents a grade will be
converted to float when it is read as a value in the dictionary. The code is expected
to print the name and grade of the student that are read in each execution of the
for loop. A grade is considered success if it is 70 or above, and failure if it is below
70. The code will count the number of successes, numSuccesses, and the number
of failures, numFailures. It will print successFailureRatio, which is numSuccesses
divided by numFailures
The post Write a Python code that gets a file name from a user appeared first on My Assignment Online.