On Tue, May 17, 2011 at 12:54 PM, I. Dooba <ido...@gmail.com> wrote:

> Thanks, Joel Goldstick
>
> There is no error message.
> But the program is returning incomplete or too many characters.  For
> example, instead of "Halal" it will return "l Hala"
> or "nol" depending on the length of the word the user inputs.
>
> Since I can't predict the words the user will search for, I'm finding it
> difficult to tackle the problem.
> ___________
> I. Dooba
> Hybrid Intelligence & Digital Infrastructure Research Group
> Universiti Teknologi PETRONAS
> +6014 644 5086
> ibraheem_g01...@utp.edu.my
>
>
> I haven't read the book you are using, so I don't know what lessons they
are trying to teach in this example.  However, you should be aware that if
you read the input into a variable first, then do the .find() method
separately on the next line, you can later find out how long the word your
user typed (google python length of string if you don't know how).  Use this
length value to add to the start of your index so that you can start your
result at the beginning of Halal or Haram.  Then at least, if the word is in
your list you will get the answer you expect.

> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Joel Goldstick
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to