Type hints and data contracts
What can this function return at runtime?
Examples
Worked example
Input
def double(n: int) -> int: return n * 2; double("a")Expected output
"aa"
Hints and solution
Hint 1
Write down the starting state and walk through one example by hand.
Reveal worked answer
The annotation is descriptive. Python applies string repetition when a string is multiplied by 2.