Tokenize a string: Difference between revisions

(Add Seed7 example)
Line 153:
'''Interpreter:''' Python 2.5
 
words = "Hello,How,Are,You,Today".split(',')
forlist_of_words word in= words:.split(',')
print word'.'.join(list_of_words)
 
If you want to print each word on its own line:
This prints each word on its own line. If we want to follow the task specification strictly, we join the array elements with a dot, then print the resulting string:
 
for word in list_of_words:
print '.'.join("Hello,How,Are,You,Today".split(','))
print word
 
or
Or replace the '.' with '\n' and do:
 
print "\n".join("Hello,How,Are,You,Today".split(',')list_of_words)
 
==[[Ruby]]==
Anonymous user