0
how to use assert in try except block, please give any practical example
1 Answer
0
Are you asking how you would apply try except in your code in a practical way?
if so, lets say you're making a calculator:
try
user=int(input("What's your first number?") #User input for for integer number
except:
print("Please type in a number")
'''
Generally, you use try and except for when you're expecting an error due to faulty user input and you would inform the user with plain English rather than computer language
'''