python - [] became None after appending -
I am trying to store raw input in an empty list I am quite new to the python. And apparently, the input was not in the empty list. Then what happened? Latitude = [] longitude = [] Print Latitude # ** returns [] ** Lat_input = raw_input ("Your latitude is: ") Latitude = Lat .append (Lat_input) Print Latitude # ** No one found me here ** long _input = raw_input (" what is your longitude: ") longitude = longitude.Open (long_input)
I saw some other postings, yet I did not know what I did. what did I miss? Why have my list gone? Thanks, guys!
Just run: ... not This design and intent is: Returning If you did not want to change existing attachment is an in-place operation; It does not return any value.
underlined. Append (long_input)
longitude = longitude .append (long_input)
none instead of a value makes it clear that the function is being called for its side effects rather than its return value.
longitude in place, but wanted to create a new list instead of enclosing new items, you can use it instead :
longitude = long [+]>
Comments
Post a Comment