samedi 22 février 2020

Unclear If statement functionaning

Can you explain the reason for unclear if statement functioning of ordinary code below?

numbers = "677 2584 238 3126 1366 646 2560 2439 543 379 1048 2053 2518 1496 2537 1983 118 2105 1175 145 311 1881"
listed_numbers = numbers.split(" ")
max = listed_numbers[0]
min = listed_numbers[0]
for each in listed_numbers:
    if each >= max:
        max = each
    if each <= min:
        min = each

print(str(max) + " " + str(min))

Code link attached https://repl.it/join/grsvacto-nihilisticrefor

P.S: If question seems to be unclear or inaccurate, please indicate the fragment that is perplexing, or edit my questions. This will help me to ask the question later.

Aucun commentaire:

Enregistrer un commentaire