belongs to collection: Python Tuple Exercises
Given:
tuple1 = (10, 20, 30, 40, 50)
Expected output:
(50, 40, 30, 20, 10)
Hint:
Use tuple slicing to reverse the given tuple. Note: the last element starts at -1.
Solution:
tuple1 = (10, 20, 30, 40, 50) tuple1 = tuple1[::-1] print(tuple1)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Hint:
Use tuple slicing to reverse the given tuple. Note: the last element starts at -1.
Solution:
need an explanation for this answer? contact us directly to get an explanation for this answer