🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित प्रोग्राम का आउटपुट क्या है?

What is the output of the following program ?

print "Hello World"[::-1] 
A)
B)
C)
D)

Explanation:

The given Python code is:

print "Hello World"[::-1]

Explanation:

  • "Hello World" is a string.
  • [::-1] is a slicing operation that reverses the string.
    • The slice notation [::-1] means "take the string and step backwards by 1, effectively reversing it."

So, reversing "Hello World" gives: "dlroW olleH"

Output:

(A) dlroWolleH

Note: In Python 3, print requires parentheses, so the correct code would be print("Hello World"[::-1]). However, based on the given code, it seems to be Python 2, where print doesn't need parentheses.

Latest Updates