0

Can you help how can i reverse sa number using tuple im python

Reverse

26th Sep 2020, 8:15 PM
Arlyn dela Cruz
Arlyn dela Cruz - avatar
7 Réponses
+ 1
OK. Add your try Arlyn dela Cruz. Or complete the topic of tuple and list slicing. t = (1,2,3,4,5) makes a tuple t[start:end:count] will used slice a list from start to end by incrementing counter for next element by count. And using negative numbers will retrieve list from backwards. So print( t[ : : -1]) will print tuple in reverse. Here start, end are not specified means take minimum index to maximum index of tuple.. So output (5,4,3,2,1). For more clear, complete the lesson first. Edit: t = (1,2,3,4,5) print(t[ : : -1])
26th Sep 2020, 8:31 PM
Jayakrishna 🇮🇳
+ 1
T = () x = len(T) for i in range (x,0,-1): print(i)
28th Sep 2020, 2:50 AM
Ashutosh Pattnaik
Ashutosh Pattnaik - avatar
0
Number or numbers? Pls try first by yourself and post your try if you struck between..
26th Sep 2020, 8:18 PM
Jayakrishna 🇮🇳
0
Numbers
26th Sep 2020, 8:19 PM
Arlyn dela Cruz
Arlyn dela Cruz - avatar
0
#If you read all carefully, you can understand code. I already added that as edit last 2 lines. Again adding, just copy paste playground.. #Code : Arlyn dela Cruz just copy these 2 lines to playground and see t = (1,2,3,4,5) print(t[ : : -1])
27th Sep 2020, 12:35 PM
Jayakrishna 🇮🇳
0
I get it
1st Oct 2020, 2:28 AM
Arlyn dela Cruz
Arlyn dela Cruz - avatar
- 1
Give me the correct code pls
26th Sep 2020, 8:52 PM
Arlyn dela Cruz
Arlyn dela Cruz - avatar