vendredi 28 août 2020

Replacing user input with random strings

I would like to replace a user's input with random strings from a list. Here is an example of what I mean:

print("Use /U for an uppercase letter, /L for a lowercase letter, /0 for a random number, Anything else to type what you want")
Pattern = input("Enter your pattern here: ")

Now Pattern should look something like this: ABC-/U-/L-/0

Now, it should replace every /U with an uppercase letter, every /L with a lowercase letter, every /0 with a random number and everything else should stay the same.

And then Pattern should look like this: ABC-Y-z-7

I have tried using the .replace() method before, but that did not go as planned




Aucun commentaire:

Enregistrer un commentaire