Type hints in action

Report a typo

Replace the spaces in the following bits of code so that it matches the requirements. Consider that the typing module is already imported. Please follow the PEP formatting rules and use the formatting provided in the code samples from the theory section - no missing or extra whitespaces. Mark the following function's return type as a string:

Fill in the gaps with the relevant elements

def function1() [...]:

Mark the following function's return type as string:

def function1() :
    return "This function should return a string!" 

Mark the following function's return type as a set of floats:

def function2() :
    return {1, 2, 3, 4} 
___

Create a free account to access the full topic