0

I am trying to write a grade calculator based on class rank, both functions work up until the last elif statement that would classify the grade input as an 'A', any ideas on what's wrong?

def undergradg(rank,score):
    if rank=='U' and score>='52' and score<='63':
            return ('D')
    elif rank=='U' and score>='64' and score<='75':
            return ('C')
    elif rank=='U' and score>='76' and score<='87':
            return ('B')
    elif rank=='U' and score>='88' and score<='100':
            return ('A')


def gradgrades(rank,score):
    if rank=='G' and score>='60' and score<='69':
            return ('D')
    elif rank=='G' and score>='70' and score<='79':
            return ('C')
    elif rank=='G' and score>='80' and score<='89':
            return ('B')
    elif rank=='G' and score>='90' and score<='100':
            return ('A')
rdas
  • 20,604
  • 6
  • 33
  • 46
Bardock
  • 1
  • 1
  • We don't know the type of `score` but it looks like you are comparing strings (otherwise you will get error). – buran Oct 15 '22 at 09:04

0 Answers0