# This program says hello and asks for my name.
print('Hello world!')
print('What is your name?') # ask for their name
myName = input()
print('It is good to meet you, ' + myName)
print('The length of your name is:')
print(len(myName))
print('What is your age?') # ask for their age
myAge = input()
print('You will be ' + str(int(myAge) + 1) + ' in a year.')
1.6 程序剖析
print()
len()
input()
str()、 int()和 float()函数
>>> str(29)
'29'
>>> print('I am ' + str(29) + ' years old.')
I am 29 years old.