score函數的公式?
def main(): score = float(input('請輸入成績: ')
) if score >= 90: grade = 'A' elif score >= 80: grade = 'B' elif score >= 70: grade = 'C' elif score >= 60: grade = 'D' else: grade = 'E' print('對應的等級是:', grade) if __name__ == '__main__': main() 2、也可以將五分制構造出一個字符串'EEEEEEDCBAA',用以下方法實現這個功能:
score = int(input()) degree = 'EEEEEEDCBAA' if (score > 100 or score < 0): print('Data error!'
) else: print(degree[score//10])
上一篇是否有聲音輸出
下一篇csv的文件如何打開