This question seems mind-boggling simple, yet I can\'t figure it out. I know you can check datatypes in python, but how can you set a conditional based on the datatype? For
let me declare variable x of type int
x = 2 if type(x) == type(1) or isinstance(x, int): # do something
Both works fine.