loading...

re: Daily Challenge #68 - Grade Book VIEW POST

FULL DISCUSSION
 

Python

#The function
def call_mean (x,y,z):
  mean = ((x+y+z)/3)
  mean_s = (str(mean))
  print ("\nMean: ",mean)
  if (mean > 100): print("\nWrong input, try again...")
  else:
    #The statement
    if ((mean <= 100 and mean >= 90)):
      if (mean_s[1] >= '5'): print ("A+")
      else: print ("A-")
    elif ((mean < 90 and mean >= 80)):
      if (mean_s[1] >= '5'): print ("B+")
      else: print ("B-")
    elif ((mean < 80 and mean >= 70)):
      if (mean_s[1] >= '5'): print ("C+")
      else: print ("C-")
    elif ((mean < 70 and mean >= 60)):
      if (mean_s[1] >= '5'): print ("D+")
      else: print ("D-")
    elif ((mean < 60 and mean >= 0)):
      if (mean_s[1] >= '5'): print ("F+")
      else: print ("F-")

#Three value from input
x = int(input("first int: "))
y = int(input("second int: "))
z = int(input("third int: "))

#Call the function
call_mean(x,y,z)
code of conduct - report abuse