[Tutor] New User

Alan Gauld alan.gauld at freenet.co.uk
Mon Apr 18 19:02:23 CEST 2005


> Would someone have a look at the attached .py file and tell me if i
have
> done it correctly, im running in the dark a bit as i have only
started
> today, the exercise was

Fair enough for a first time yes.
We prefer not to use input to read numbers(*) since it can be abused
as a security loophole so its usually better to use raw_input() for
everything and convert to the appropriate type:

num = int(raw_input('Type a number: '))

But otherwise it looks fine.

(*) And yes, I know my own tutor describes the use of input(), I
really
must get round to removing that bit...

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list