Type hints

What is the output of the code in Listing 1?

Listing 1: A code snippet that defines a function add_one_to with type hints.
def add_one_to(num: int) -> int:
    result: int = num + 1
    return result

print(add_one_to(5))
print(add_one_to(3.5))

Choose the correct option:

  • The code will print 6 and raise a TypeError.
  • The code will print 6 and 4.
  • The code will raise a TypeError and print 4.
  • The code will print 6 and 4.5.