On 12/10/18 04:31, Adam Eyring wrote: > Also, it looks better to use " + " instead of a comma: > print("Combining these foods will you," + new_food)
It may "look better" but be aware that they don't do the same thing and the plus sign is a lot less efficient computationally since it creates a new string for each addition. For a simple case like this it won't matter but if you had a lot of short strings being added together in a loop it could slow things down quite a bit. The other problem with the plus sign is that it requires all arguments to be strings whereas the comma separated list gets automatically converted to a string by Python (by calling str(x) ) so is in general more reliable. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor