Posts

Showing posts from May, 2022
 DEL VARIABLE my_variable1 = 20 my_variable2 = "GeeksForGeeks" # check if my_variable1 and my_variable2 exists print(my_variable1) print(my_variable2) # delete both the variables del my_variable1 del my_variable2 # check if my_variable1 and my_variable2 exists print(my_variable1) print(my_variable2)
EXCEPTION HANDLING a = 4 b = 0 try : k = a//b print (k) except ZeroDivisionError : print ( "Can't by zero" ) finally : print ( 'This is always executed' ) print ( "The value of a / b is : " ) assert b != 0 , "Divide by 0 error" print (a / b)