Akansha Yadav builds a Python grade calculator that converts numeric scores to letter grades using conditional thresholds: A for 90+, B for 80+, C for 70+, D for 60+, F otherwise. The program collects student names and scores, stores them in a list, and prints formatted results.
Chapters
Let's create a grade calculator using Python. We are going to use basic concepts like functions, loops. So I am creating function over here, passing score as a variable. So I'm checking if score is greater than 90, keeping it as A. If score is greater than 80, keeping it as B. 70, then C. If greater than 60, then D. Else it will return F, which is going to be fails. Now I'm creating the main function, keep taking an input of number of students, number of students that the person has in the class. Then creating a list of students. Then I am creating a for loop in which I am passing the range of number of students. Then taking the name of entry of name and then the score entry and then calculating the grade using the grades above. So now I'm appending all the things into our list that we have created in line number 15. Now I am taking all 3 items— name, score, and grade— and printing it using formatting in strings. And here I am writing if name is equal to equal to main. Now let's test it. Enter the number of student, I am writing 5. So if I am writing any character in case of score, so we will get this error which is invalid literal for integer. Now I am going to run the program again. It again asks us like enter the number of students, I am entering 2. Suppose AKA is the first student and score is 25. Second student name we have to keep, so let's suppose it's KAA and score is 65. So here we got the grade results. If you like the video, don't forget to subscribe the channel and hit the bell icon.