Problem 4: Greeting Function with Default Argument
Easypython
Learn the Concept: FunctionsProblem Description
Write a function greet_user(name, language="English") that prints a greeting message in the specified language. If no language is given, it should default to English. Support at least English and Hindi greetings.
Input
A name, and optionally a language.
Output
A greeting message in the requested language.
Constraints
- Language will be either
"English"or"Hindi"if provided.
Example Input
textname = "Aarav", language = "Hindi"
Example Output
textNamaste, Aarav!
Concepts Covered
Functions, default parameters, conditionals, string formatting.
Related Problems
- Problem 1: Simple Interest Calculator FunctionEasy · pythonSolve Problem
- Problem 2: Even or Odd Checker FunctionEasy · pythonSolve Problem
- Problem 3: Average of a List FunctionEasy · pythonSolve Problem