Q. What is the output of the following code?

Code:
x = 'Python'
print(x[0])
  • (A) P
  • (B) y
  • (C) n
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) P
Explanation: Strings in Python are indexed starting at 0, so x[0] gives 'P'.
Explanation by: Ankit Singh
Strings in Python are indexed starting at 0, so x[0] gives 'P'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
88
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ankit Singh
Publisher
πŸ“ˆ
86%
Success Rate