当我输入 [-2,-2,-5,6,0] 序列时遇到问题,它会打印 -2 而不是 6 问题,以打破任何其他解决方案?
z = []
a = 0
max = 0
while True:
b = int(input("Enter a Number ").strip())
z.append(b)
if b == 0:
break
while a < len(z) :
if z[a] > z[a+1]:
max = z[a]
break
a += 1
print(f"the max number is {max} his appearence is :{z.count(max)}")