निम्नलिखित प्रोग्राम का आउटपुट क्या है:
What will be the output of the following Python code?
str1="helloworld"
str1[::-1]
A)
B)
C)
D)
Explanation:
The code str1[::-1]
reverses the string str1
.
Explanation:
str1 = "helloworld"
- The slice notation
[::-1]
reverses the string.
So, "helloworld"[::-1]
becomes "dlrowolleh"
.
The correct answer is:
(A) dlrowolleh.