Lesson 15: Functions: Reusable Blocks

One function, greet, is defined once and called twice. Change the first name and run again — only the first greeting changes, which shows the same block being reused.

Loading Python… this can take a few seconds the first time. Please wait — the Run button will become available when Python is ready.

Try this: Change the name to Alex and press Run again — the first greeting becomes “Hello, Alex!” and the Sam greeting stays the same.

The code that runs



Output

Press Run to see the output here.