+ 2
How to print the characters in the list in reversed format
List contains characters and symbols
6 ответов
+ 4
hi,
you can use something like that:
lst = [1, 2, 3, '?', '*', 'a', 'b', 'c']
for i in lst[::-1]:
if str(i).isalnum():
print(i, end = '')
# output = cba321
+ 4
Like this?
https://code.sololearn.com/c9vkx6q1ACpJ/?ref=app
Otherwise if it's just the letters you need, you can just do something like:
print(*reversed([l for l in list_ if l.isalpha()]))
+ 2
It contains symbols too so have to reverse only the alphabets
+ 2
Yeah
+ 1
print(*reversed(your_list))
+ 1
Ah okay. That's mildly trickier then. :)