The British GSCE grading system has recently changed and has got confusing and it just doesn't work. I just got my estimated grades and did not know what was good and what wasn't. To help my confusion I decided to make something to save, convert and edit my grades. To make my code neater I decided to use two for loops so it just prints them all out. When I tried this it looked like it was working but it just printed "For English language, you got 6c" then when it moved on to what was meant to be English literature it just printed "For English language, you got 6c", I did get 6c but the subject is not English language. The same happens if I rearrange the order of the for loops only the grades are the same but the lessons were normal.
All I've done is rearranged the for loops. Nothing seems to work. Here is the code:
import time
with open('lessons.txt', 'r') as f:
english_language = str(f.readline().strip('\n'))
english_lit = str(f.readline().strip('\n\n'))
maths = str(f.readline().strip('\n\n\n'))
chemistry = str(f.readline().strip('\n\n\n\n'))
physics = str(f.readline().strip('\n\n\n\n\n'))
biology = str(f.readline().strip('\n\n\n\n\n\n'))
re = str(f.readline().strip('\n\n\n\n\n\n\n'))
business = str(f.readline().strip('\n\n\n\n\n\n\n\n'))
computer_science = str(f.readline().strip('\n\n\n\n\n\n\n\n\n'))
french = str(f.readline().strip('\n\n\n\n\n\n\n\n\n\n'))
geography = str(f.readline().strip('\n\n\n\n\n\n\n\n\n\n\n'))
lessons = []
lessons.extend((english_language, english_lit, maths, chemistry, physics, biology, re, business, computer_science, french, geography))
lesson_name = ["English langauge", "English liturature", "Maths", "Chemistry", "Physics", "Biology", "R.E", "Business studies", "Computer science", "French", "Geography"]
print("What do you want to do? Read your grades, edit your grades, convert your grades or read and convert your grades.")
option = input("Say read to read your grades or edit to edit your grades: ")
if option == "read":
for i in lessons:
for name in lesson_name:
print("For", name, "you got",i)
time.sleep(3)
break
elif option == "convert":
import converter.py
elif option == "edit":
print("HIIIIIIIIIIIIIIIIIIII")
In the files are grades spanning from 5B, being the lowest I got, to 7B is the highest I got.
What I expect it to do is ask you what you want to do, which it does. Then if you enter 'read' it will say 'For English language, you got 6c' and repeat until it gets to Geography.