Answers for "write a python program that calculates the sum of two given integers within the range [0...9] and prints the answer to the terminal."

1

write a python program that calculates the sum of two given integers within the range [0...9] and prints the answer to the terminal.

integers = []
for i in range (2):
    while True:
        try:
            new_integer = int(input ('Insert integer: '))
            if new_integer not in range (10):
                print ('ERROR: Invalid input! Integer must be in range [0...9]!')
                continue
            integers.append(new_integer)
            break
        except:
            print('ERROR: Invalid input! Input must be an integer!')
print (f'Result: {sum(integers)}')
Posted by: Guest on June-02-2021

Code answers related to "write a python program that calculates the sum of two given integers within the range [0...9] and prints the answer to the terminal."

Python Answers by Framework

Browse Popular Code Answers by Language