+ 1
List comprehension for swapcase
Any idea on how to write a fucntion using list comprehension which has similar properties as swapcase?
3 Respuestas
+ 8
s='AbcDefG'
print(*[i.upper() if i.islower() else i.lower() for i in s],sep='')
Any idea on how to write a fucntion using list comprehension which has similar properties as swapcase?