Is there any method for number reversible in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there any method for number reversible in Python?

14th Aug 2019, 11:41 AM
Bhuwan Khadka
Bhuwan Khadka - avatar
4 Answers
+ 1
Cbr✔[ Most active ] I am quite sure this code won’t run you made a typo I think :) check the end of your reversed variable :)
14th Aug 2019, 12:03 PM
Brave Tea
Brave Tea - avatar
0
You mean a method to reverse numbers ? Like 123 => 321 ?
14th Aug 2019, 11:42 AM
Dlite
Dlite - avatar
0
you can use numbers in a list and reverse the list lst = [1,2,3] rev_lst = lst[::-1] print(lst) print(rev_lst) you can also use lst.reverse() beware there is a difference the reverse() function reverses the list so that lst is now in reverse. it actually changes the list the first option, [::-1] is just a different way of printing the original list
14th Aug 2019, 11:44 AM
Brave Tea
Brave Tea - avatar
14th Aug 2019, 11:55 AM
Brave Tea
Brave Tea - avatar