On Mar 31, 2014, at 5:15 AM, Dave Angel <[email protected]> wrote:
>
> Do you know how to define and initialize a second local variable?
> Create one called i, with a value zero.
>
> You test expression will not have a literal, but compare the two
> locals. And the statement that increments will change i, not
> n.
So like this?
def print_n(s,n):
i = 0
while i < n:
print s,
i += 1
print_n('a',3)
So this is basically making i bigger by +1 every time the while loop passes
until it passes n, then it becomes false right?
Also, with this exercise it’s using a doctest so I don’t actually call the
function so I can’t figure out a way to make the string’s print on separate
lines without changing the doctest code?
Thanks for all of the help!
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor