December 4th, 2012, 10:30 AM
Printing words in one line using for loop
this is the code i think i ****ed things up cuz it only output Z
for c in range(0, 26):
December 4th, 2012, 10:43 AM
It's hard to tell what indentation you had in mind for the print since you didn't use code tags. I think you're only real problem is that you kept updating "a" instead of "b". If that's so, here's what I did in v2.7 (should mostly work in v3._ except for the "print"):
Originally Posted by renegade7
>>> for c in range(0, 26):
>>> print b
December 4th, 2012, 09:12 PM
Thanks alot you helped me out!
But i have a question, Why would i update be when b is "" i tested in Python v3 and it worked. But i just couldn't comprehend it.
December 5th, 2012, 10:11 AM
You are making "a" b a different character, a=chr(ord('A')+c), in each successive iteration. You want to append that character to an ever-growing string, "b", that was initialized to "".
December 25th, 2012, 03:35 AM
Last edited by evol; December 25th, 2012 at 03:36 AM.