#10-6
a = input('Please input two numbers.')
b = input()
try:
a = int(a)
b = int(b)
re = a + b
except ValueError:
print('Please input number.')
else:
print(str(a) + ' + ' + str(b) + ' = ' + str(re))
#10-7
flag = 0
while flag == 0:
a = input('Please input two numbers.')
b = input()
try:
a = int(a)
b = int(b)
re = a + b
except ValueError:
print('Please input number.')
else:
print(str(a) + ' + ' + str(b) + ' = ' + str(re))
flag = 1
#10-2message = 'Hello, my friend'print(message)message.replace('friend', 'partner')print(message)#10-3filename = 'guest.txt'with open(filename, 'a') as f_ob:i = input('Enter your name:')f_ob.write(i)#10-4filename = 'guesst_book.txt'with open(filename, 'a') as f:t = input('Enter your name: (input "exit" to exit)')while(t != 'exit'):print('Welcome! ' + t)f.write(t + '\n')t = input('Enter your name:')#10-5filename = 'reason.txt'with open(filename, 'a') as f:t = input('Why do you like programming? (input "exit" to exit)')while(t != 'exit'):print('We got it.')f.write(t + '\n')t = input('Why do you like programming? (input "exit" to exit)')