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
  • 22,866
  • 14
  • 82
  • 131
Dan A
  • 404
  • 1
  • 6
  • 19
  • 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
  • 404
  • 1
  • 6
  • 19