On Mar 28, 2014, at 10:36 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > > A good programming exercise will show an example input and the expected > output, to give an unambiguous test case. Does the homework have that? This is what the exercise has as examples…
"""Print the string `s`, `n` times. Parameters ---------- s -- A string n -- an integer, the number of times to print `s' Examples -------- >>> print_n("hello", 3) hello hello hello >>> print_n("bye", 0) >>> print_n("a", 6) a a a a a a """ assert isinstance(s, str) assert isinstance(n, int) #TODO: Implement the function > > If not, you're unfortunately left to your own interpretation of what the > requirements mean. > I’m not sure what assert isinstance means? This is what I have, it works but I’m not sure it’s what the exercise is asking for. n = 5 def print_n(s, n): while n > 0: print s * n break print_n("hello\n", 10) _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor