-1
TamanhoDoVetor = int(input("Tamanho do vetor ? "))
print()
Vetor = [0] * TamanhoDoVetor
def CriaVetor(VetorNumeros,Tamanho):
for i in range(Tamanho):
VetorNumeros[i] = str(input("Elemento do vetor posição " + str (i+1) + " ? "))
def NumerosEstaoEmOrdemCrescente(VetorOriginal,Tamanho):
Resultado = True
for a in range(Tamanho):
b = a + 1
if a == Tamanho - 1:
b = a
if VetorOriginal[a] > VetorOriginal[b]:
Resultado = False
if Resultado == False:
print("Os elementos do seu vetor não se encontra em ordem crescente")
else:
print("Os elementos do seu vetor encontra-se em ordem crescente")
CriaVetor(Vetor,TamanhoDoVetor)
NumerosEstaoEmOrdemCrescente(Vetor,TamanhoDoVetor)
in this code above they serve to know if the numbers of a vector are in ascending order, if the size of my vector is less than or equal to 9 and the entries are in ascending order type: 1, 2, 3, 4, 5, 6, 7, 8, 9 respectively the result is true, however if my vector is size 10 or larger, and my number input is 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 respectively the result and false, but how to see the result is true because they are in ascending order, but the code returns me false. I can’t identify the error!
Thanks man, I spent all day trying to solve this problem, but without success so far, I copied this part of the code from another issue, this part that found the error, and I was trying to look for the error within the other function!
– Fenix