Doubt with Lists

Asked

Viewed 54 times

1

When I type this command in the console, it returns me an empty list. But if I create a file and have it executed, nothing appears, what happens? How should I do?

lista = []

x = 1

while x > 0:
    x = int(input('digite um numero inteiro: '))
    lista.append(x)

print (lista)
  • Your file is in the . py? extension You have tried typing without the accent on "I"?

  • Put your code in so we can see

  • Folks excuse me, I was forgetting a little detail, put the print before, see the code

  • 2

    How exactly are you creating the file and having it run?

2 answers

1

On your terminal python3 nome_arquivo.py

0

to run on terminal use python nome_arquivo.py remembering that it should be in the same folder that the file is in. I surrounded your script here and it worked perfectly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.