python中出现'>=' not supported between instances of 'str' and 'int'错误


提示错误为: TypeError: '>=' not supported between instances of 'str' and 'int'
因为 input 接收到的都是字符串类型,解决方案是转变字符类型。
score=int(input ("请输入你的成绩:"))
if score >= 90:
print('优秀')
elif score < 90 and score>=80:
print('良好')
elif score < 80 and score>=60:
print('及格')
else:
print('不及格')


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM