0

how to use assert in try except block, please give any practical example

25th Nov 2016, 9:50 AM
sajid
1 Réponse
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 '''
12th Jan 2017, 5:31 PM
Darth Vador
Darth Vador - avatar