While working with "sorting out a tuple" in dive deep into data types from starter kit I have taken my initial variable name as "originaltuple " and assigned certain values , later I have sorted function to sort the order of "originaltuple" into another variable name "newsortedtuple" , now I rerooted this variable to another new variable name "ultranewsortedtuple" and again used reverse function expecting to return my initial variable "originaltuple" but i got output as "NONE"
You are trying to use .reverse() method which is an in-built function in python to reverse the items. You can't assign the function to a variable. The correct syntax is provided below:
originaltuple=(24,32,2,65,0,3,4,95)
sortedtuple=sorted(originaltuple)
sortedtuple.reverse()
Comments
0 comments
Article is closed for comments.