Type Hint

Domain: Programming Fundamentals

🎯 Motivation

Type hints annotate variables and functions with expected types, making code clearer and enabling tool support.

πŸ“‹ Concrete Example

def greet(name: str) -> str: return 'Hello, ' + name - hints say name should be a string and the function returns a string.

πŸ”— Analogy

Labels on containers - β€˜this jar is for sugar, this one for salt’. The label doesn’t stop you from putting salt in the sugar jar, but it helps you avoid mistakes.