I have to add and subtract values when letters and numbers are in certain places in the random string of characters as follows:

*1. Letters within a string = +1*

*2. Capital letter beginning string = +1*

*3. Capital letter within or at end of string = -2*

*4. Number or other symbol in string = -2 AND deduct .25 for each letter in
string.*

I can get the random string of characters, but I am having difficulty adding these values with 'x'.

```
import random
import math

x=0

def randstr(localX):
    a = 'abcdefghijklmnopqrstuvwxyz'
    b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    c = '0123456789'
    d = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
    rs = (random.choice(d)) + (random.choice(d)) + (random.choice(d)) + (random.choice(d)) + (random.choice(d)) + (random.choice(d)) + (random.choice(d)) + (random.choice(d)) + (random.choice(d)) + (random.choice(d))
    print rs
    if rs[0] in b:
        localX += 1
    if rs[0] in a:
        localX += 1
    elif rs[1] in a:
        localX += 1
    elif rs[2] in a:
        localX += 1
    elif rs[3] in a:
        localX += 1
    elif rs[4] in a:
        localX += 1
    elif rs[5] in a:
        localX += 1
    elif rs[6] in a:
        localX += 1
    elif rs[7] in a:
        localX += 1
    elif rs[8] in a:
        localX += 1
    elif rs[9] in a:
        localX += 1
    if rs[1] in b:
        localX -= 2
    elif rs[2] in b:
        localX -= 2
    elif rs[3] in b:
        localX -= 2
    elif rs[4] in b:
        localX -= 2
    elif rs[5] in b:
        localX -= 2
    elif rs[6] in b:
        localX -= 2
    elif rs[7] in b:
        localX -= 2
    elif rs[8] in b:
        localX -= 2
    elif rs[9] in b:
        localX -= 2
    if rs[0] in c:
        localX -= 2
        if rs [1] in a:
            localX -= .25
        elif rs [2] in a:
            localX -= .25
        elif rs [3] in a:
            localX -= .25
        elif rs [4] in a:
            localX -= .25
        elif rs [5] in a:
            localX -= .25
        elif rs [6] in a:
            localX -= .25
        elif rs [7] in a:
            localX -= .25
        elif rs [8] in a:
            localX -= .25
        elif rs [9] in a:
            localX -= .25
    elif rs[1] in c:
        localX -= 2
        if rs [0] in a:
            localX -= .25
        elif rs [2] in a:
            localX -= .25
        elif rs [3] in a:
            localX -= .25
        elif rs [4] in a:
            localX -= .25
        elif rs [5] in a:
            localX -= .25
        elif rs [6] in a:
            localX -= .25
        elif rs [7] in a:
            localX -= .25
        elif rs [8] in a:
            localX -= .25
        elif rs [9] in a:
            localX -= .25
    elif rs[2] in c:
        localX -= 2
        if rs [0] in a:
            localX -= .25
        elif rs [1] in a:
            localX -= .25
        elif rs [3] in a:
            localX -= .25
        elif rs [4] in a:
            localX -= .25
        elif rs [5] in a:
            localX -= .25
        elif rs [6] in a:
            localX -= .25
        elif rs [7] in a:
            localX -= .25
        elif rs [8] in a:
            localX -= .25
        elif rs [9] in a:
            localX -= .25
    elif rs[3] in c:
        localX -= 2
        if rs [0] in a:
            localX -= .25
        elif rs [1] in a:
            localX -= .25
        elif rs [2] in a:
            localX -= .25
        elif rs [4] in a:
            localX -= .25
        elif rs [5] in a:
            localX -= .25
        elif rs [6] in a:
            localX -= .25
        elif rs [7] in a:
            localX -= .25
        elif rs [8] in a:
            localX -= .25
        elif rs [9] in a:
            localX -= .25
    elif rs[4] in c:
        localX -= 2
        if rs [0] in a:
            localX -= .25
        elif rs [1] in a:
            localX -= .25
        elif rs [2] in a:
            localX -= .25
        elif rs [3] in a:
            localX -= .25
        elif rs [5] in a:
            localX -= .25
        elif rs [6] in a:
            localX -= .25
        elif rs [7] in a:
            localX -= .25
        elif rs [8] in a:
            localX -= .25
        elif rs [9] in a:
            localX -= .25
    elif rs[5] in c:
        localX -= 2
        if rs [0] in a:
            localX -= .25
        elif rs [1] in a:
            localX -= .25
        elif rs [2] in a:
            localX -= .25
        elif rs [3] in a:
            localX -= .25
        elif rs [4] in a:
            localX -= .25
        elif rs [6] in a:
            localX -= .25
        elif rs [7] in a:
            localX -= .25
        elif rs [8] in a:
            localX -= .25
        elif rs [9] in a:
            localX -= .25
    elif rs[6] in c:
        localX -= 2
        if rs [0] in a:
            localX -= .25
        elif rs [1] in a:
            localX -= .25
        elif rs [2] in a:
            localX -= .25
        elif rs [3] in a:
            localX -= .25
        elif rs [4] in a:
            localX -= .25
        elif rs [5] in a:
            localX -= .25
        elif rs [7] in a:
            localX -= .25
        elif rs [8] in a:
            localX -= .25
        elif rs [9] in a:
            localX -= .25
    elif rs[7] in c:
        localX -= 2
        if rs [0] in a:
            localX -= .25
        elif rs [1] in a:
            localX -= .25
        elif rs [2] in a:
            localX -= .25
        elif rs [3] in a:
            localX -= .25
        elif rs [4] in a:
            localX -= .25
        elif rs [5] in a:
            localX -= .25
        elif rs [6] in a:
            localX -= .25
        elif rs [8] in a:
            localX -= .25
        elif rs [9] in a:
            localX -= .25
    elif rs[8] in c:
        localX -= 2
        if rs [0] in a:
            localX -= .25
        elif rs [1] in a:
            localX -= .25
        elif rs [2] in a:
            localX -= .25
        elif rs [3] in a:
            localX -= .25
        elif rs [4] in a:
            localX -= .25
        elif rs [5] in a:
            localX -= .25
        elif rs [6] in a:
            localX -= .25
        elif rs [7] in a:
            localX -= .25
        elif rs [9] in a:
            localX -= .25
    elif rs[9] in c:
        localX -= 2
        if rs [0] in a:
            localX -= .25
        elif rs [1] in a:
            localX -= .25
        elif rs [2] in a:
            localX -= .25
        elif rs [3] in a:
            localX -= .25
        elif rs [4] in a:
            localX -= .25
        elif rs [5] in a:
            localX -= .25
        elif rs [6] in a:
            localX -= .25
        elif rs [7] in a:
            localX -= .25
        elif rs [8] in a:
            localX -= .25
    return rs
    return localX
randstr(localX)

```