[Tutor] while loop

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Mar 31 10:39:31 CEST 2014


On 31/03/2014 03:13, Scott Dunning wrote:
>
> On Mar 30, 2014, at 4:29 AM, Dave Angel <davea at davea.name> wrote:
>>
>> You're getting closer.   Remember that the assignment shows your
>> function being called with 10, not zero.  So you should have a
>> separate local variable,  probably called I, which starts at
>> zero, and gets incremented each time.
>>
>> The test in the while should be comparing them.
>>
> So, this is what I have now and it ‘works’ but, instead of printing (s) on seperate lines they’re all on the same line?
>
> def print_n(s,n):
>      while n < 10:
>          print s * n
>          break
>      assert isinstance(s, str)
>      assert isinstance(n, int)
>

They say that the truth hurts, so if that's the best you can come up 
with, I suggest you give up programming :(

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com




More information about the Tutor mailing list