Bird
0
0

What will be the output of this Python code on Raspberry Pi?

medium📝 Predict Output Q5 of 15
Raspberry Pi - Security and Deployment
What will be the output of this Python code on Raspberry Pi?
stored_user = 'admin'
stored_pass = '1234'
input_user = 'Admin'
input_pass = '1234'
if input_user.lower() == stored_user and input_pass == stored_pass:
    print('Welcome')
else:
    print('Try again')
AError
BTry again
CWelcome
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Convert input_user to lowercase

    'Admin'.lower() becomes 'admin'.
  2. Step 2: Compare with stored_user and stored_pass

    Both username and password match after conversion.
  3. Step 3: Print result

    Condition True, so print('Welcome').
  4. Final Answer:

    Welcome -> Option C
  5. Quick Check:

    Case-insensitive username check = Welcome [OK]
Quick Trick: Use .lower() to ignore case in username [OK]
Common Mistakes:
MISTAKES
  • Ignoring case conversion
  • Assuming case-sensitive match
  • Confusing output messages

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes