Hi everyone,
the instructor of the Python For Everybody course has shown several lists up until this point, one example is the list
friends = [ ‘Joseph’, ‘Glenn’, ‘Sally’ ]
I’m wondering if it’s necessary to have the blanks at the beginning and the end, as he has sometimes left them out. Does this have any meaning?
Thanks for your time!
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Do you mean spaces inside of the [] before first and after last elements? It’s not necessary, sometimes it might help with making things easier to read.
Although this rule isn’t stated explicitly, the second example there seems to recommend no space between the bracket and quote. (Unless you are breaking it up into multi-line.)
Personally, I don’t mind that extra space. I might go with having each name on a separate line.