[Tutor] IF Statements

Alan Gauld alan.gauld at btinternet.com
Mon Oct 6 19:09:16 CEST 2008


"Rajeev Nair" <rajeev1204 at gmail.com> wrote
> also i believe the first line can also be written as 'x = 
> input('enter
> .......') instead of using x=int(raw_input('......') . use raw_input 
> for
> string and just input for integer.

No, use input() only in very special circumstances or when
experimenting for personal use only.

Use int(raw_input()) for all production code. It is much safer.

-- 
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