KnowledgeBoat Logo

Computer Science

What will be the output of the following program?

def display():
    print ("Hello",) 
display()
print("bye!")

Python

Python Functions

3 Likes

Answer

Hello
bye!
Working
  1. def display(): — This line defines a function named display with no parameters.
  2. print("Hello",) — Inside the display function, it prints the string "Hello".
  3. display() — This line calls the display function, which then prints "Hello" due to the print statement inside the function.
  4. print("bye!") — This line prints "bye!" on a new line.

Answered By

1 Like


Related Questions