Python Try Except:
The try block lets you test a block of code for errors.
The except block lets you handle the error.
The finally block lets you execute code, regardless of the result of
  the try- and except blocks.
When an error occurs, or exception as we call it, Python will normally
  stop and generate an error message.
try:
    n = int(input())
    m = int(input())
    sum = int(n) + int(m)
    print(sum)
except:
    print("error")
NOTE:
input() is returning string. 
int(input()): if input string is representing an integer it will convert string into integer and try block will execute, othervise it will return an error and exept block will execute