Skip to Content.
Sympa Menu

byte-of-python - Re: [Byte-of-Python] Continue statement

byte-of-python AT lists.ibiblio.org

Subject: Discussion regarding the book 'A Byte of Python'

List archive

Chronological Thread  
  • From: "沈洁元" <orion_val AT 163.com>
  • To: "discussion regarding the book 'a byte of python'" <byte-of-python AT lists.ibiblio.org>
  • Subject: Re: [Byte-of-Python] Continue statement
  • Date: Fri, 5 Aug 2005 09:14:11 +0800 (CST)

Gary,
I've tested your example. And it works well as it expects. If I input 'he' -- a less-than-3-characters string, 'first statement...' and 'second statement...' is printed, and 'Input is of sufficient length' won't be output.

Juan Shen

> In working thru the examples, there are 2 things I don't understand regarding the continue example in chapter 6.
> 1. If I put print statements before the continue, no output is produced.
> Example:
> while True:
> s = raw_input('Enter something : ')
> if s == 'quit':
> break
> if len(s) < 3:
> print 'first statement before continue'
> print 'second statement before continue'
> continue
> print 'Input is of sufficient length'
> 2. As the example is shown, it doesn't matter what size string is input, the script will always output "Input is of sufficent length", as long as the string isn't quit.
>
> Thank you in advance for any help or comments in clarifying this for me
>
> Gary






需要一个2000兆的免费邮箱吗?
网易免费邮箱是中国最多人使用的电子邮箱。




Archive powered by MHonArc 2.6.24.

Top of Page