1 input()函数来实现用户输入,程序在等待输入的时候会终止,获取用户的输入后继续
message = input("tell me something,and I will repreat it back to you:")
print(message)
2 使用int来获取数值输入
age = input("How old are you?")
age= int(age)
print(age)
3 求模运算符
number = input("Enter a number,and i'll tell you if it's even or odd:")
number= int(number)if number % 2 == 0:
print("\n the number" + str(number) + "is even.")else:
print("\n the number" + str(number) + "is odd.")