[Tutor] (no subject)

Roelof Wobben rwobben at hotmail.com
Thu Aug 26 08:25:34 CEST 2010


Hello, 

 

I have this exercise :

 

Try each of the following formatted string operations in a Python shell and record the results:

“%s %d %f” % (5, 5, 5)
“%-.2f” % 3
“%-10.2f%-10.2f” % (7, 1.0/2)
print ” $%5.2fn $%5.2fn $%5.2f” % (3, 4.5, 11.2)
 

But if I try in a python 2.7 IDLE enviroment I get this :

 

>>> %s %d %f % (5, 5, 5)
SyntaxError: invalid syntax
>>> print “%s %d %f” % (5, 5, 5)
SyntaxError: invalid syntax

 

Roelof

 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100826/ed3b8a2a/attachment.html>


More information about the Tutor mailing list