promptdojo_

Arguments, defaults, and the silent wrong-order bug — step 8 of 9

Write a function called greet that takes a name and an optional mood parameter. mood should default to "good". The function should return the string f"hi {name}, hope you're {mood}".

Then call greet twice and print both results:

  • greet("alex") — uses the default
  • greet("sam", "great") — overrides it

Expected output:

hi alex, hope you're good
hi sam, hope you're great

full-screen editor opens — close anytime to keep reading.