[Solved] Change specific letters in string using string manipulation


I do not exactly the rules you want to realize. Here is a simple example, how you could do things. Tell us more about your rules and your tries and you will get better answers.

import random
def random_change_case(old):
    new = ''
    for c in old:
        r = random.random()
        if r < 0.4:
            new += c.lower()
        elif r > 0.6:
            new += c.upper()
        else:
            new += c
    return new

for i in range(10):
    print i, random_change_upper('Hello World')

solved Change specific letters in string using string manipulation