Skip to main content
Skip to content

Conditions · Beginner

Grade Calculator Program in Hindi Coding

Average marks for several students and assign a grade.

The program

Edit anything and press Run. The output below was produced by running this exact code.

Expected output

Press Run to try it

Aarav -> 92% Grade: A+Isha -> 72% Grade: BKabir -> 31% Grade: Fail

How it works

Each student is an object with a naam and a list of marks, and all students sit in one list. The outer loop visits each student; the inner loop adds up that student's marks.

The percentage is the average rounded with ganit.round (each subject is out of 100). grade_batao checks the bands from highest to lowest and returns the first match, so 92 becomes A+ without also matching the lower bands.

pct + "%" joins the number and the percent sign into one piece of text.