On Mar 29, 2014, at 12:47 AM, Dave Angel <da...@davea.name> wrote: > > So did your code print the string 10 times? When asking for help, > it's useful to show what you tried, and what was expected, and > what actually resulted. > > You use * to replicate the string, but that wasn't what the > assignment asked for. So take out the *n part. You're supposed to > use iteration, specifically the while loop. > > Your while loop doesn't quit after 10 times, it keeps going. Can > you figure out why?
This works without a break. Is this more a long the line of what the excercise was looking for you think? > def print_n(s, n): while n <= 10: print s n = n + 1 print_n("hello\n", 0) _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor