Python Program to Catch Multiple Exceptions in One Line

bookmark

string = input()

try:
    num = int(input())
    print(string+num)
except (TypeError, ValueError) as e:
    print(e)

 

Input

a
2

Output

can only concatenate str (not "int") to str