python how to convert Nonetype to int or string

Error:TypeError: int() argument must be a string or a number, not 'NoneType'
 
solution:
try:
    answer = my_value / divisor
except TypeError:
    answer = 0 

3 comments: