So I made a quiz. I've saved user quiz in a text file from Python. I have come to know how to allow a teacher to see the user names in alphabetical order with their score from the text file.
def alpha (): b = open ("class x.txt", "r") fo = sorted for x in sorted (fo) .Redline (): Print (X) DEF beta (): B = Open ("Class Y.txt", "R") for fo = b.readlines () Sorted in (fo): Impression (X) Def charlie (): b = open (sorted "class z.txt", "r") for fo = b.readlines () sorted (fo): print (x) option = input ("what You want to score a score by / from the score: a) Alphabetical with the highest score If the option == "A": if class == "X": alpha () Eleph Class == "Y": Beta () Eleph class == "Z": Charlie () `
Whatever I am trying to do, it displays the names of all the characters from the text file, with which I have been successful.
My text file looks like this.
Joe: 2 Prison: 4 Lawrence: 1 Harry: 2 Nakita: 2
I was wondering if anyone Help me to explain how I Received the highest with the user name score in order to have the textfile like to include it as shown above I have used version 3.2.2 Python.
No comments:
Post a Comment