What you will learn
Define functions, pass arguments and return results.
Practise
Add type hints and reject negative dimensions.
Common mistake
Calling a function and printing its result are separate actions unless the function prints internally.
Define functions, pass arguments and return results.
Add type hints and reject negative dimensions.
Calling a function and printing its result are separate actions unless the function prints internally.
Experiment with the program below. Your code and input are sent to the selected compiler only when you run it.
Tab indents · Shift+Tab unindents · Esc then Tab leaves the editor · Ctrl/Cmd+Enter runs · Ctrl/Cmd+S saves a draft
Changes save automatically to your account.
No input required.Expected output for the original program
24
Output will appear here.
Educational simulation — object identities and execution steps are illustrative.