0
Constructing a program prompts the user to type positive integers, ending with 0, whose output is "yes X", without the quotation marks, if the sequence contains X positive values and forms an increasing sequence; otherwise print "not X".
a = int(input("Digite o primeiro valor da sequencia: "))
b = int(input("Digite o segundo valor da sequencia: "))
i=1
if a == 0:
print("nao ", 0)
if a>0 and b == 0:
print("sim ", 1)
while a>0 and b>0:
i=2
c = int(input("Digite outro valor da sequencia: "))
if c>b:
i = i + 1
if c<b:
i = i + 1
a = int(input("Digite algum outro valor da sequencia: "))
b = a
c = b
a = c
if a == 0 and c>b:
print("sim ", i)
if a == 0 and c<b:
print("nao ", i)
if c == 0 and c>b:
print("sim ", i)
if c==0 and b<c:
print("nao ", i)
Apparently not, but you can do better, but the code is confused and we don’t know the goal, which makes it difficult to say something appropriate.
– Maniero
So the goal is "a program that prompts the user to enter positive integers, ending with 0, and whose output is "yes X", without the quotation marks, if the sequence contains X natural values and forms a crescent sequence; otherwise print "not X".
– Rafael Kenji Tetsuya