#!/usr/bin/python
# _*_ coding: utf-8 _*_

import math

print ""
# str() 将值转化为适于人阅读的形式
# repr() 转化为供解释器读取的形式

s = 'Hello, World'
print str(s)
print repr(s)
print str(1 / 7)

x = 10 * 3.25
y = 200 * 200
s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...'
print s

hello = 'hello, world\n'
hellos = repr(hello)
print hello
print hellos

print repr((x, y, ('hello', 'world')))
print str((x, y, ('hello', 'world')))

for x in range(1, 11):
    print repr(x).rjust(2), repr(x * x).rjust(3),
    #print repr(x * x * x).rjust(4)
    print repr(x * x * x).ljust(4),
    print repr(x * x * x).center(4)

for x in range(1, 11):
    print '{0:2d} {1:3d} {2:4d}'.format(x, x * x, x * x * x)

x = '123456'
print x.ljust(3)[:3]

y = '-3.1415'
print x.zfill(10)
print y.zfill(10)

print 'we are the {} who say "{}!"'.format('knight', 'Ni')

print 'The story of {0}, {1}, and {other}'.format('Bill', 'Manfred', other =\
        'Georg')

print 'The value of PI is approximately {0:.3f}.'.format(math.pi)

table = {'Louis': 1990, 'Shana': 2006, 'Miku': 2000}
for name, birthday in table.items():
    print '{0:10} ==> {1:10d}'.format(name, birthday)

print 'Louis: {0[Louis]:d}; Shana: {0[Shana]:d}; Miku: {0[Miku]:d}'\
        .format(table)

print 'Louis: {Louis:d}; Shana: {Shana:d}; Miku: {Miku:d}'.format(**table)

print 'The value of PI is approximately %5.3f.' % math.pi




