[Tutor] Why does my code show this?

Nathan Pinno falcon3166 at hotmail.com
Mon Jul 11 08:39:19 CEST 2005

  Thanks to all in the group. Mini_calc is now up and running successfully 
and is now available to download from my site.

  Thanks again,
  ----- Original Message ----- 
  From: "Alan G" <alan.gauld at freenet.co.uk>
  To: "Nathan Pinno" <falcon3166 at hotmail.com>; <tutor at python.org>
  Sent: Sunday, July 10, 2005 5:03 PM
  Subject: Re: [Tutor] Why does my code show this?

  >>  cal_opt = int(raw_input("What option would you like: "))
  > Here you get the input and convert it to a number (int() )
  > which is fine.
  >>  if cal_opt == "1":
  > But here you compare it to a string (see the quotes).
  > So either remove the convertion to int() around raw_input or
  > remove the quotes around the values. The things you compare
  > must be the same type.
  >>  That's not an option. Try again.
  >>  Option: 3
  >>  3*4
  >>  12
  > I'm not sure how the multiplication appeared though!
  > Alan G.

More information about the Tutor mailing list