Hi I've been learning python through andrew harrington's guide, but i got stuck on a problem where you enter a list (ex. and have the IDLE return this----> 'veryhotday'.
Ive been thinking on how to do that using a for loop statement as was intstructed in the guide.

I know this may sound dumb but I guess I really need to see a sample code to do it. Thanks!

Recommended Answers

All 2 Replies

Hi I've been learning python through andrew harrington's guide, but i got stuck on a problem where you enter a list (ex. and have the IDLE return this----> 'veryhotday'.
Ive been thinking on how to do that using a for loop statement as was intstructed in the guide.

I know this may sound dumb but I guess I really need to see a sample code to do it. Thanks!

its not sounding dumb. Its about watching and learning from it.

try this

list =  ["very", "hot", "day"]
print "".join(list)

Just a note, don't use function names like list as variable names.

mylist =  ["very", "hot", "day"]
print "".join(mylist)  # veryhotday

# or use this, might be more descriptive for a beginner

# empty string
s = ""
for word in mylist:
    # concatenate words
    s += word

print s  # veryhotday
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.