[Tutor] Please help, the program is not behaving as I want

Joel Goldstick joel.goldstick at gmail.com
Tue May 17 17:38:39 CEST 2011


On Tue, May 17, 2011 at 11:20 AM, I. Dooba <idooba at gmail.com> wrote:

> I'm new to programming and have decided to start with Python following the
> advice of experts including Eric S. Raymond.
> So far I've learnt quite a lot from this list.
>
> However, I've the following problem.
>
> The program was designed (as part of my practice with Head First
> Programming) to check whether an ingredient is Halal or Haram.
> I've a simple table online where some ingredients are either halal or
>  haram.
>
> For example, if the user enters "water" the program is supposed to tell him
> that it's halal;
> but it's returning "&gt;" and other characters I don't want to see.
>
> What am I doing wrong?
>
> import urllib.request
>
> page = urllib.request.urlopen("
> http://halalingredients.theparleyonline.com/")
> text = page.read().decode("utf8")
>
> halal_haram_status = text.find(input("Enter the ingredient:  "))
> begin_final_status = halal_haram_status + 3
> end_final_status = begin_final_status + 5
> status = text[begin_final_status:end_final_status]
> print(status)
>
>
> ______________


Can you copy and paste the error message traceback that you get?

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


-- 
Joel Goldstick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110517/5a158a90/attachment.html>


More information about the Tutor mailing list