[英]How do you code negative numbers in python
i am coding a project to see how many numbers are over 100. when all data has been inputted, you need to input -1 to display how many times numbers over 100 have been entered.我正在编写一个项目,看看有多少个数字超过 100。当所有数据都输入后,您需要输入 -1 以显示输入了多少次超过 100 的数字。 code is as follows:代码如下:
x=0
score= 0
while score != -1:
score=input(int('Enter a Number'))
If score >= 100:
x=x+1
Else:
(print' ')
End if
End While
print(‘The number of numbers which were over 100 is’ X)
x = 0
score = 0
while score != -1:
score = int(input(('Enter a Number ')))
if score >= 100:
x = x + 1
print('The number of numbers which were over 100 is', x)
hopefully this will work according to your expectation.希望这将按照您的期望工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.