Search code examples
pythonlistraw-input

In python, how do I make a raw_input of a list from one number?


I need some code that allows a user to input a number (ie. 5) that creates a list of all the numbers leading up to that number excluding zero (ie. [1,2,3,4,5])


Solution

  • >>> range(1,int(raw_input('Number: '))+1)
    Number: 5
    [1, 2, 3, 4, 5]