Skip to content
Advertisement

Python change lowercase to uppercase

I need help with python program. I don’t know how to make python change at least 1 lowercase letter to uppercase.

JavaScript

Advertisement

Answer

You want a password with at least one uppercase letter but it shouldn’t be every character. First get length random lowercase letters. Then get some random indexes (min. 1, max. length-1) that should be transposed to uppercase.

JavaScript

You can check what’s going on if you print the variables

JavaScript

Example output:

JavaScript

If you’re not familiar with the generator syntax where pin is build, it roughly translates to:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement