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
Post a Comment