Jump to content

range()


Anonymouskiller
 Share

Go to solution Solved by pwseo,

Recommended Posts

  • Solution

Anonymouskiller,

Antes de responder à tua questão, deixa-me dizer-te algo: o título que deste ao tópico é péssimo. É do interesse de toda a gente que o alteres para algo que descreva minimamente o teu problema, como por exemplo "função range() não dá o resultado esperado".

E agora a tua questão. O que se passa é que o livro que estás a ler foi feito nos tempos do Python 2.x e tu estás provavelmente a utilizar Python 3.x, repara:

~ $ # Primeiro com Python 3
~ $ python3
>>> range(4)
range(0, 4)
>>> 
~ $
~ $ # e agora Python 2
~ $ python2
>>> range(4)
[0, 1, 2, 3]
>>> 

Na versão 3 houve muitas alterações (algumas delas incompatíveis com a versão 2). Se estás a ler um livro escrito para a v2, talvez seja boa ideia instalares também essa versão.

Edited by pwseo
OP alterou o título da thread de "python" para "duvida range()"
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.