[Tutor] Help with converting a string into a integer

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Oct 31 15:43:32 CET 2013


On 31/10/2013 02:00, Carmen Salcedo wrote:
> Hi Everyone,
>
> I hope you're having a great week.  I'm working on this program that
> converts strings to integers. Can someone please help me out? :) Below
> is the program:
>
> def main():
>      selection = input("Enter you choice. Enter 1 " +
>                     "for Phone Translator or 2 for Backward String.")
>      while selection != 1 and selection !=2:
>          print "Invalid choice"

I can tell from the print that you're using Python 2.x.  For reasons 
that I won't go into here never, ever use input, use raw_input instead. 
  So try that and when you hit problems please get back to us, giving 
the data that Bob Gailer asked for earlier.

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence



More information about the Tutor mailing list