πŸ“Š Python
Q. What is the output of the following code?
Code:
x = 'abcd'
print(x[::-1])
  • (A) abcd
  • (B) dcba
  • (C) bcda
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) dcba

Explanation: The slice [::-1] reverses a string.

Explanation by: Ankit Singh
The slice [::-1] reverses a string.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
37
Total Visits
πŸ“½οΈ
4 mo ago
Published
πŸŽ–οΈ
Ankit Singh
Publisher
πŸ“ˆ
93%
Success Rate