Editor

Default Parameters

#8 · Functions · Beginner · 35 XP · about 3 min

Write a function called greet_person(name, greeting="Hello") that creates a greeting message with an optional greeting word.

Example

greet_person("Alice")             # Returns "Hello, Alice!"
greet_person("Bob", "Hi")         # Returns "Hi, Bob!"
greet_person("Eve", "Welcome")    # Returns "Welcome, Eve!"

Requirements

  • The greeting parameter should default to "Hello"
  • Return a string in the format: "{greeting}, {name}!"
  • Include the comma and exclamation mark

Fastest solvers

Leaderboard

First solves only, ranked by stars and then time.