2022-03-19 10:13:00 +00:00
|
|
|
print('Lesson ','1','"start"...\n')
|
2022-03-20 05:46:27 +00:00
|
|
|
|
|
|
|
print("-------Demo 1-------\n")
|
2022-03-19 10:13:00 +00:00
|
|
|
str = input('Please input your name:\n')
|
2022-03-20 05:46:27 +00:00
|
|
|
print('Your input name is:',str)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print("-------Demo 2-------\n")
|
|
|
|
# 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))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print("-------Demo 3-------\n")
|
|
|
|
print('The sum is %.1f' %(float(input('Enter first number: ')) + float(input('Enter second number: '))))
|