[Tutor] modification
Ignacio Vazquez-Abrams
ignacio@openservices.net
Mon, 20 Aug 2001 11:58:43 -0400 (EDT)
On Mon, 20 Aug 2001, Dutch wrote:
> going through 'Core python programming' and modified an example to see
> what would happen. Well, errors happen.
>
> I wanted it to ask me for a number then loop that many time and finally
> report to me what my number was. This is what I typed that made the
> erros:
>
> num = raw_input ('What shall I count to? ')
> counter = 0
> while counter <= num:
> print 'loop #%d' %(counter)
> counter = counter + 1
> print 'Your number was: %d', %num
>
>
> -Dutch
It seems that you have neglected to tell us:
1) What error you're getting, and
2) What version of Python you're using
When I run this under Python 1.5.2 it loops forever because for each number x
and any string y, the comparison x<=y is always true.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>