#p2-3 print('Python is fun') #p2-3 (escape sequence) print('let\'s go') #p2-5 last 2 lines, print with 2 parameters r=2 print("r=2 area=", 2*2*3.14) #p2-8 format of print print(format(100,'d')) print(format(100,'o')) print(format(100,'4d'), 'xxx', format(100, '5d')) # comma as seprator, so format use % and this does NOT work print ('%5d', 100) as format print('%5d' % 100) #p2-15 # >>> print ('|', '%8.2f' % 123.456, '|') print ('' % 123.456) #>>> print ('|%8.2f|' % 123.456) print ('|%8.2f|' % 123.456) #p2-17 note: (,) however last one need extra bracelet print ('width=%2d height = %2d area = %3d' % (5,7,24))