python - Extend string to a list inside a list -


list = [ [ ] ] money = int(raw_input("enter total money spent: ")) 

in program want extend money variable list inside list, when print it, appears [ ["money variable input"] ]. planning on adding other items same element. how can this? thanks.

just use "append" method on first element of list. since list multi-dimensional array, first element array, have "append" method. example:

list = [ [ ] ] money = 10 list[0].append(money) list 

prints [[10]]


Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -

collision detection - C++ library for mesh to mesh intersection: what is available? -