📜  在 python 代码示例中从用户获取字符串输入

📅  最后修改于: 2022-03-11 14:45:36.141000             🧑  作者: Mango

代码示例3
# Store input numbers
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')

# Add two numbers
sum = float(num1) + float(num2)

# Display the sum
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))