inputs: # get input 
test1 = '{}'     # 1 group, score 1 
test2 = '{{{}}}' # 3 group 
test3 = '{{},{}}' # 3 group 
test4 = '{{{},{},{{}}}}' # 3 group 
test5 = '{<a>,<a>,<a>,<a>}' # 3 group 
test6 = '{{<ab>},{<ab>},{<ab>},{<ab>}}' # 3 group 
test7 = '{{<!!>},{<!!>},{<!!>},{<!!>}}' 
test8 = '{{<a!>},{<a!>},{<a!>},{<ab>}}' 
puzzle =  open('day09.txt', 'r').read()   # Read as a string

# Loop through the string counting the nest while ignoring the garbage along the way 
score = 0
opengroups = 0 
prev = ''                   # This is a hack for the '!', fix later todo 
stream = puzzle 
isgarbage = False 
for index, value in enumerate(stream):
    if prev == '!':
        prev = ''
    elif value == '!':
        prev = '!'
    elif value == '{' and isgarbage == False:
        opengroups += 1
        score = score + opengroups        # todo check this 
    elif value == '}' and isgarbage == False:
        opengroups -= 1 
    elif value == '<' and isgarbage == False:
        isgarbage = True 
    elif value == '>': 
        isgarbage = False 
print("Open groups (should be 0) = ", opengroups)
print("Total groups = ", score)
Given the above code, generate some markdown instructions for it.

targets: 
What I learned  
* I always forget about range to create a list of numbers 
* next % size
* I don't understand numpy take or warp 
* You can format a hex number with format(the number, the format you want) '02x' says make sure it is in two digits 
Advent of Code Day 9
 Advent of Code Day 9 - Part 1  A large stream blocks your path. According to the locals, it's not safe to cross the stream at the moment because it's full of garbage. You look down at the stream; rather than water, you discover that it's a stream of characters.
You sit for a while and record part of the stream (your puzzle input). The characters represent groups - sequences that begin with { and end with }. Within a group, there are zero or more other things, separated by commas: either another group or garbage. Since groups can contain other groups, a } only closes the most-recently-opened unclosed group - that is, they are nestable. Your puzzle input represents a single, large group which itself contains many smaller ones.
Sometimes, instead of a group, you will find garbage. Garbage begins with < and ends with >. Between those angle brackets, almost any character can appear, including { and }. Within garbage, < has no special meaning.
In a futile attempt to clean up the garbage, some program has canceled some of the characters within it using !: inside garbage, any character that comes after ! should be ignored, including <, >, and even another !.
You don't see any characters that deviate from these rules. Outside garbage, you only find well-formed groups, and garbage always terminates according to the rules above.
Here are some self-contained pieces of garbage:
<>, empty garbage.
<random characters>, garbage containing random characters.
<<<<>, because the extra < are ignored.
<{!>}>, because the first > is canceled.
<!--!-->
, because the second ! is canceled, allowing the > to terminate the garbage.
<!--!!-->

, because the second ! and the first > are canceled.
<{o"i!a,<{i<a>, which ends at the first >.
Here are some examples of whole...