Personal Hello

Interfaces feel friendlier when they greet a user by name, but sometimes no name is provided. Write a function hello that takes a string name. If the name is not empty, return Hello, Name! with the first letter uppercase and the rest lowercase; if it is empty, return Hello, World!.

Примеры

Ввод
"john"
Вывод
"Hello, John!"
Ввод
""
Вывод
"Hello, World!"
Ввод
"ALELI"
Вывод
"Hello, Aleli!"

Нужно реализовать

def hello(name: str) -> str:

Теги

strings
PostgreSQLv16

Siia ilmub koodi käivituse tulemus

Visible tests
1
Input
"john"
Expected"Hello, John!"
2
Input
""
Expected"Hello, World!"
3
Input
"ALELI"
Expected"Hello, Aleli!"
4
Input
"bOb"
Expected"Hello, Bob!"
5
Input
"zoE"
Expected"Hello, Zoe!"
6
Input
"a"
Expected"Hello, A!"
Focus radio
Paused · SomaFM · Fluid