大家帮我看看呢,我实在是不知道问题出在哪
Topic source我在学习条件判断章节的时候了解到input返回的是str类型数据,不能和数字直接比较。我突发灵感,既然不能比较那一定就不能计算。所有我返回到这里来,调整了一下我之前的问题代码,结果顺利运行。一块石头终于落下,我很开心。以下是修改之后的代码。
name=input('please enter your name') print('Hello',name) s1=input('How many points did you get last term') s2=input('How many points did you get this term') n=int(s1) m=int(s2) c=(m-n)/n print(r'''wa o you have done a good job your score is increasing%.1f%%'''%c)
s1=int(input('How many points did you get last term')) s2=int(input('How many points did you get this term')) 这样就可以计算了
- 1
nightmarelink
name=input('please enter your name') print('Hello',name) s1=input('How many points did you get last term') s2=input('How many points did you get this term') print(r'''wa o you have done a good job your score is increasing%.1f%%'''%(s2-s1)/s1)