CBSE Class 12 Computer Science Question 48 of 101

Functions — Question 16

Back to all questions
16
Question

Question 13(iv)

What will be the output of the following program?

def display():
    print ("Hello",) 
display()
print("bye!")
Answer
Output
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.