>>     print "The value in years is", principal

> To actually answer your question, in order to print this correctly, 
> you
> need to tell Python to convert the integer (principal) to a string 
> by
> using the built-in function str() like so:

Not so. print automatically calls str() on all its arguments so
the programmer doesn't need to.

An alternative way to solve your probnlem is to use format strings:

print "Years = %s;\tPrincipal = %s" % (years,principal)

HTH,

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

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to