Learn Python: string

name = input('What is your name?\n')
age = input('How old are you?\n')
location = input('Where are you from?\n')
hobby = input('What do you like?\n')

result = 'Hello {}, age of {}, from {}, and you like {}.'
output = result.format(name, age, location, hobby)
print(output)

#或者
#print('Hello {}, age of {}, from {}, and you like {}.'.format(name, age, location, hobby))

 

posted @ 2017-07-09 22:23  mxyzptlk  阅读(69)  评论(0)    收藏  举报