0

create a program that gets the marks the user has for their classes this year. Tell them how many
classes they are failing (despite what many o
f you think a fail is 50%)
Save
as
Name_Surname_Repetition_Problem1.py................i seriuosly need help with this program,python is giving me a hard tym

2
Contributors
1
Reply
21
Views
3 Years
Discussion Span
Last Post by sneekula
0

Hint:

# assume this is your data file (CSV type)
# each line has last name, first name, grade
data = '''\
Miller,Jean,75
Paulson,Peter,47
Tanner,Abraham,88
Norton,Sheila,33
'''

filename = "grades123.txt"
# write a test file
with open(filename, "w") as fout:
    fout.write(data)

# now read your test file back in and process the data
with open(filename, "r") as fin:
    for line in fin:
        # remove trailing newline char
        line = line.rstrip()
        # split the line at the commas
        line_list = line.split(",")
        print(line, line_list)  # test
        # unpack the line
        last, first, grade = line_list
        # now check if int(grade) <= 50
        # and tell person (last first) if they failed

You will have to work with more than one grade in your data line.

Edited by sneekula

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.