SubhanUllah Posted September 19, 2022 Report Share Posted September 19, 2022 thelist = [1, 2, 3, 4] #Inverse of list order. print(thelist[::-1]) #OUTPUT [4, 3, 2, 1] #Inverse of list items. from fractions import Fraction for i in thelist: print(Fraction(1, i)) #OUTPUT 1 1/2 1/3 1/4 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.