[Solved] How can I take an integer input from user and store it to an array? [closed]


Try changing the last line to:
print str(number)

This will change the list into a printable string representation.

If you want to learn more about strings and formatting, check out Chapter 7 of the Python Tutorial. Actually, the whole tutorial is pretty awesome. 🙂

EDIT: David is correct in his comment below…print converts lists to strings automatically (I suppose it does so for any type with a defined string conversion). I’m still a noob too. :p

Anyway, I just checked your code in the Python interpreter, and it worked (as Lukáš Lalinský said it should). Have you checked your indentation? Also, if you happen to be using Python3, you’ll need to turn print into a function, e.g.:
print(number)

2

solved How can I take an integer input from user and store it to an array? [closed]