sh_09_ formatted output
1 # define a string variable name, my name called the Little Ming output, please take care! 2 name = " Size Ming " 3 Print ( " My name is% s, please take care! " % Name) 4 5 # define integer variables student_no, the output of my student number is 000001 6 student_no = 100 123 456 7 Print ( " I 06D is student number% " % student_no) . 8 . 9 # defines a decimal. price, weight, Money, 10 # outputs apple monovalent 9.00 yuan / kg, purchased 5.00 pounds, required to pay 45.00 yuan . 11 . price 8.5 = 12 is weight 7.5 = 13 is=. price * Money weight 14 Print ( " Apple Price% .2f yuan / kg, purchased% .3f pounds, need to pay% .4f dollars " % (. price, weight, Money)) 15 16 # definition of a decimal scale, output % is the proportion of data 10.00 . 17 Scale 0.8 = 18 is Print ( " data proportion of .2f %%% " % (Scale * 100))