I woke up this morning and couldn’t wait to get started on my #python for #100DaysOfCode. I was itching to get started. Had a continuation idea from the night before of adding to a global variable and depending upon that value, having different loops run.
This threw me for a loop and I could barely function. Get it? Loops? Functions?
I know it’s ugly. Took me a bit to learn that only had to declare global variable once in a function.
But, moving forward, my idea is that a T-Intersection is t_intersection()
and would run a function of ‘choose left or right’ whereas a four-way intersection might be four_way()
and offer left/right/straight.
I’m not sure how to pull this off. My head tells me that the code is run from top to bottom. But my gut tells me that all root levels are equally important and can run in any order. Obviously I am mistaken, or to be more accurate, I don’t fully grok how code relates to itself.
The output of this is pretty ugly. Spaces, indents, and more problems. Plus, if one just doesn’t play, with the first question of opening the gate or not, if you select no, it displays the right string afterward, but also an error because my block
variable is a 0, and the while
loop at the bottom needs something for that.