Bird
0
0

What will the following code print if the user enters hello?

medium📝 Predict Output Q5 of 15
Python - Input and Output
What will the following code print if the user enters hello?
text = input('Say something: ')
print('You said:', text)
AYou said: 'hello'
Bhello
CYou said: text
DYou said: hello
Step-by-Step Solution
Solution:
  1. Step 1: Understand input() stores user input as string

    The variable text will contain the string 'hello'.
  2. Step 2: Analyze the print statement

    The print outputs the string 'You said:' followed by the value of text.
  3. Final Answer:

    You said: hello -> Option D
  4. Quick Check:

    Print concatenates string and input value correctly [OK]
Quick Trick: input() stores exactly what user types as string [OK]
Common Mistakes:
MISTAKES
  • Expecting quotes in output
  • Printing variable name instead of value
  • Missing comma in print

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes