Generation

generate functionFri, 23 Dec 2022

Prolog: This kata series was created for friends of mine who just started to learn programming. Wish you all the best and keep your mind open and sharp! Task: Write a function that will accept two parameters: variable and type and check if type of variable is matching type. Return true if types match or false if not. Examples: 42, "int" --> True "42", "int" --> False

def type_checker(variable, type): if type(variable) == type: return True else: return False

Questions about programming?Chat with your personal AI assistant