0

Is there a way to convert a string to a sequence of uppercase and lowercase letters inside a command? For example, al_sp "Kilometers" → KiLoMeTeRs

Here is what I tried so far but I am not getting any output, any help is appreciated

@commands.command()
    async def rand(self, c, upperlower):
        upperlower = upperlower.join([char.upper() if i%2==0 else char.lower() for i, char in enumerate(upperlower)])
        await c.message.delete()
        await c.send(upperlower)
Torxed
  • 21,617
  • 13
  • 80
  • 125
Dan A
  • 365
  • 1
  • 3
  • 15
  • Are you getting an error message? Do you have an `on_message` event? (if so, please post it). Finally `upperlower.join` should be `''.join` – Patrick Haugh May 29 '20 at 02:13

1 Answers1

0

Thank you Patrick Haugh for pointing this out

I needed to replace upperlower.join with ''.join

Dan A
  • 365
  • 1
  • 3
  • 15