Module 01 ยท Python Basics โ Lesson 4 of 4 ยท ~9 min
Functions
def instead of func
Swift declares a function with func. Python uses def, and the body is indented instead of braced:
def greet(name):
return f"Hello, {name}!"return works exactly like Swift's return โ it hands back a value and exits the function immediately. Unlike Swift, Python doesn't require (or even support) a -> ReturnType arrow by default โ that's an optional type hint you'll meet in a later module, not an enforced contract.