0
Why does this code give this output?? <built-in method reverse of list object at 0x7e3911ffc0>
My code was x=["yg","g","h"] print(x.reverse) Why doesn't it work? Can you please tell me the right code?
3 Answers
+ 6
x. reverse()... better it is
print(x. reverse) prints the method itself
additionally it is an inplaceMethod as Jan Markus already wrote.
to create a new object
print(reversed(x)).... not sure at alk
+ 5
The reverse method needs to be called to do anything.
This will work:
x=["yg","g","h"]
x.reverse() # reverse elements of x. Notice the () brackets.
print(x)
+ 2
Hot today
What's wrong? :(
1 Votes
Why won't my image display
0 Votes
I have made a calculator in which my % (Percentage) not work correctly for 100%50 or 100%20.
2 Votes
How the answer is 50?
0 Votes
Number of Ones ( C++ ) question!
1 Votes