[Tutor] bug in exam score conversion program

Alan Gauld alan.gauld at btinternet.com
Sun Oct 5 02:03:48 CEST 2008


"Dragos Ionescu" <idragos at ymail.com> wrote 

> David try this:
>
> score = input("What is your exam score: (0-100)? ")

No, please don't! input has several security issues, it is 
much better to use raw_input but convert the result to 
the type you need:

score = int(raw_input("What is your exam score: (0-100)? "))


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list