def greet():
for name in names:
return (f'Hello, {name.title()}!')
names = ['ron', 'tyler', 'dani']
greets = greet()
print (greets)
Why this code isn't returning all the names?
The expected output should be:
Hello, Ron!
Hello, Tyler!
Hello, Dani!
But I'm getting only:
Hello, Ron!
When I use print instead of return within the function I am able to get all the names, but with the return I can't. Some help please?