要怎麼讓我的輸出
「A,B,C,D,F」在同一行
這是我的程式
def calc_average(n):
average = (a+b+c+d+e)/5
print(average)
return average
def determine_grade(n):
if n >= 90:
print("A")
elif n >= 80 and n < 90:
print("B")
elif n >= 70 and n < 80:
print("C")
elif n >= 60 and n < 70:
print("D")
else:
print("F")
def grade(n):
n = int(input())
determine_grade(n)
return n
a=grade(1)
b=grade(2)
c=grade(3)
d=grade(4)
e=grade(5)
calc_average(a+b+c+d+e)
你到底在寫什麼...
def getAverage(n, nCount):
return n / nCount
def printGrade(n):
if 90 <= n < 100:
print("A")
elif 80 <= n < 90:
print("B")
elif 70 <= n < 80:
print("C")
elif 60 <= n < 70:
print("D")
else:
print("F")
def getScoreFromInputThenPrintGrade():
n = int(input())
printGrade(n)
return n
a = getScoreFromInputThenPrintGrade()
b = getScoreFromInputThenPrintGrade()
c = getScoreFromInputThenPrintGrade()
d = getScoreFromInputThenPrintGrade()
e = getScoreFromInputThenPrintGrade()
print(getAverage(a+b+c+d+e, 5))