print("\n\nThis is a basic program to find the letter grade for a student.")
student = input("What is the students name? : ")
test1 = input("What is the first test grade " + student.capitalize() + " recieved? : ")
test2 = input("What is the second test grade " + student.capitalize() + " recieved? : ")
test3 = input("What is the third test grade " + student.capitalize() + " recieved? : ")
averageTest = (int(test1) + int(test2) + int(test3))
print(student.capitalize() + " recieved an average test grade of " + ((averageTest) / 3))
我正在写一个基本等级的计算器程序,不能解决这个问题
TypeError: cannot concatenate 'str' and 'float' objects
我还有很多东西要写,我被困在这条线上
print(student.capitalize() + " recieved an average test grade of " + ((averageTest) / 3))
不能添加字符串和数字(float)。相反,在使用另一个字符串添加浮点数之前,请先将其转换为字符串。你可以用
在您的情况下,这将是:
^{pr2}$相关问题 更多 >
编程相关推荐