Write A Python Function To Print Hello Plus Each Name In The List

Here is a Python function to print "Hello" plus each name in the list, using the names Amar, Akbar, and Antony:

Python
def print_hello_plus_names(names):
  """Prints "Hello plus each name in the list, using the names Amar, Akbar, and Antony."

  Args:
    names: A list of names.
  """

  for name in names:
    print(f"Hello, {name}!")

# Example usage:
names = ["Amar", "Akbar", "Antony"]
print_hello_plus_names(names)

Output:

Hello, Amar!
Hello, Akbar!
Hello, Antony!

This function is similar to the previous function, but it uses the names Amar, Akbar, and Antony instead of Alice, Bob, and Carol.

Here is an example of how to use the function:

Python
# Create a list of names.
names = ["Amar", "Akbar", "Antony"]

# Print "Hello" plus each name in the list.
print_hello_plus_names(names)

Output:

Hello, Amar!
Hello, Akbar!
Hello, Antony!

This function is a simple and straightforward way to print "Hello" plus each name in a list. It can be modified to use any names you want.

Post a Comment

0 Comments