Knowee
Questions
Features
Study Tools

What is the output of the following code?  word = "Python" print(word[::-1])

Question

What is the output of the following code?  word = "Python" print(word[::-1])

🧐 Not the exact question you are looking for?Go ask a question

Solution

The output of the code will be "nohtyP". This is because the slicing operation word[::-1] in Python reverses the string.

Similar Questions

What is the output of the following program :print "Hello World"[::-1]

What does this command line print?>>> a = "Python is cool">>> print(a[-2])

What does this print?>>> a = "Python is cool">>> print(a[:6])

What is the output of the following Python code?list1=[80,90,100,120]print(list1[::-2])

What will be the output of the following Python code? t=(10,20,40,30) print(t[1:-1])

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.