Am Wed, 26 Jan 2005 15:55:28 +0000 schrieb Judi Keplar:
>
> I am currently taking a course to learn Python and was looking for
> some help. I need to write a Python statement to print a comma-
> separated repetition of the word, "Spam", written 511 times ("Spam,
> Spam, � Spam").
>
> Can anybody help me get started? I am completely new to programming!
Hi,
# This way, there is a comma after the last:
import sys
for i in range(511):
sys.stdout.write("Spam, ")
# No comma at the end:
mylist=[]
for i in range(511):
mylist.append("Spam")
print ", ".join(mylist)
Thomas
--
Thomas G�ttler, http://www.thomas-guettler.de/
--
http://mail.python.org/mailman/listinfo/python-list