Python Programming Training Certification
Flexible Hours
100 Assignments
Instructor Led online Training
50 LMS Access
24X7 Support
100% Skill Level
Enquire Now
Course Overview
Python reversed() Function
Python reversed() function returns the reversed iterator of the given sequence.
Signature
- reversed(sequence)
Parameters
sequence: It is a sequence that needs to be reversed.
Return
It returns the reversed iterator of the given sequence.
Python reversed() Function Example 1
The above example shows the working of reversed for a sequence: string, tuple, list, and range.
-
# for string
String = ‘Java’
print(list(reversed(String)))# for tuple
Tuple = (‘J’, ‘a’, ‘v’, ‘a’)
print(list(reversed(Tuple)))# for range
Range = range(8, 12)
print(list(reversed(Range)))# for list
List = [1, 2, 7, 5]
print(list(reversed(List)))
Output:
- [‘a’, ‘v’, ‘a’, ‘J’]
[‘a’, ‘v’, ‘a’, ‘J’]
[11, 10, 9, 8]
[5, 7, 2, 1]
Explanation:
In the above example, we have taken a string that consists the value “Java“, and it prints the reversed string value as the output.
In the second case, we have taken a tuple value that consists of the same value, and it prints the reversed tuple value as the output.
In the third case, we have taken a range that consists of a range of numeric values, and it prints the reversed range values as output.
In the fourth case, we have taken a list that consists of some numeric values, and it prints the reversed list value as output.
Candidate’s Journey During Our Training Program
Expert’s Advice & Selection of Module
Choosing the right type of module for the training is half the battle & Our Team of experts will help & guide you.
Get Trained
Get Trained & Learn End to End Implementation from our Expert Trainer who are working on the same domain.
Work on Projects
We Do make our student’s work on multiple case studies , scenario based tasks & projects in order to provide real-time exposure to them.
Placements
We have a dedicated placement cell in order to provide placement assistance & relevant interviews to our candididates till selection
Placement Partner