Does anybody know how to create a function that randomly changes elements in a string?
And: does anybody know how to set the chances for the type of changes?
I've tried to look it up in tutorials, but since I'm a beginner, most of the time creating random outputs, requires a lot more Python knowledge than I currently have.
Btw, I think/hope that random.randrange could be helpful, but can't really figure out how I can make it work if I don't want to use integers...
Anyway; a link to a helpful tutorial would already be very much appreciated!
There are three types of changes I want to make: deletion, insertion and replacement. I do know how these changes can be made with slices.
But the real problems are:
1) I can't get the changes to be completely random, while still asking for a string input and not integers.
2) When a change occurs (the user can request the number of changes), the type of changes should occur with certain chance ratios. I haven't found such a function yet in Python.
I am going to see what I can work out with random.choice. Thank you for your reply!