Is there a way to convert a string to a sequence of uppercase and lowercase letters?
For example, "Kilometers" → "KiLoMeTeRs".
a = 'Kilometers'
print(''.join([char.upper() if i%2==0 else char.lower() for i, char in enumerate(a)]))
result = 'KiLoMeTeRs'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With