Code
can be
horrible

Code
can be

hard

(but it doesn't have to be)

def filter_word(value, first, last, repeat, r_char):
    output = False
    value = [ x for x in value ]
    first_char, second_char, second_last_char, last_char = value[0], value[1], value[-2], value[-1]
    if first_char == first and last_char == last and second_char != last_char and ord(second_last_char) == second_last:
        if second_char in vowels and second_char in [ y for x, y in reference.iteritems() ]:
            string = []
            last = None
            for char in value:
                if last != None:
                    if char == last and char not in vowels:
                        string.append(char)
                    elif char != last:
                        string.append(char)
                else:
                    string.append(char)
                last = char
            if len(string) == len(value):
                if repeat:
                    last = None
                    for char in value:
                        if last != None:
                            if char == last:
                                output = True
                        last = char
                else:
                    third_char = value[2]
                    if ord(third_char) > ord(second_last_char) and ord(second_char) > ord(second_last_char):
                        output = True
    return output

def find_word(values, first, last, length, repeat, r_char):
    first, last, output, items, count = reference[first], reference[last], [], [], 0

This can make learning very

difficult

So. What can we do?

1. Keep it simple

Which, ironically, is hard

2. Make each thing do one thing

2. Make each thing do one thing well

3. Be organised

4. Break problems down into small steps

5. Name things clearly

6. Experiment and have fun

You can't permanently break it*

 

*(unless you're REALLY trying)

7. Don't be afraid to ask for help

Because even though it's hard, it's awesome

Fin

Codebar talk

By Spike L

Codebar talk

Codebar talk

  • 462
Loading comments...

More from Spike L