[Tutor] Help

Alan Gauld alan.gauld at freenet.co.uk
Sat Jan 15 10:25:17 CET 2005


> a = input("Type in the Grose: ")
> b = input("type in the Miles: ")
> print "a * 0.74 / b is" a*0.74/b

Try adding a comma between the message and the calculation.

print "a * 0.74 / b is", a*0.74/b

It tells print that there are two separate things to print.

Also when posting problems it is always best to 
include the actual error you get. In this case its 
simple enough but anything beyond that and the error 
report helps a lot.

Also, while input() is easy to use it is considered 
slightly dangerous since a malicious user could type 
python commands in at the prompt, so its an open door 
for security problems.

But while you are learning don;t worry too much about 
that, just bear it in mind for the future.

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