Back from my break, enjoying Men Amongst Mountains by The Revivalists. Check them out on iTunes, buy their new album. Support great artists.
And we're back from our sponsors (joking). We left off with Work Session 3 and are now ready to jump into 2.4: Control Flow & Loops: If and While. Very important skills for the developer to have in her pocket protector...
6:52 pm
While loops operate WHILE a parameter is true. If statements run code depending on certain parameters. If statements are often united with if else and else statements.
If, else statements look something like this in Python:
if (some code here): print/return (or do something other than print) else: print/return (something else)
writing if functions to check for letters in strings and greater than/lesser than problems..and am now being warned of a Collatz conjecture problem. Sounds like a smart mathematician.
Remember when testing with booleans that True and False begin with capital letters..
7:28 pm
challenging quiz to create a program that will take three numerical parameters and output the biggest. Sounds like a fun challenge using if/else statements.
7:47 pm
I have grown greatly as a programmer in the past eight months. Solved what Dave classified as a gold star problem in ten minutes. So there's a word of hope for new programmers struggling through understanding. You will achieve your goals, even if it does require some amount of mental frustration.
8:22
Dave says that all programs can be wrote with arithmetic comparisons and functions (procedures) and if statements. That's quite a profound statement. There are other tools that make programming a bit simpler, I'm assuming, but what a statement to say these three things can accomplish all things in a program.
While loops syntax looks like:
i = 0 while i != 10: i = i+1 print i
Alright, wrapped up 2.4 and can now (technically) write any code in the world...I think it's true. I know just enough to be dangerous.
8:52 pm
Forward to 2.5: Debugging
Bugs, it's a programmer's life.
I'm not sure who's Andy's partner in Debugging, but he's a natural comedian.
Best explanation of Git I've ever heard: "Basically a big undo button."
Debugging strategy recap for those (me included) wondering what I've learned
- Examine error messages when programs crash (called a Traceback in Python)
- Work from example code (copy and paste what works and play till it breaks)
- Make sure examples work
- Check (print) intermediate results (remember to remove print statements after debugging)
- Keep and compare old versions (Use a VCS like Github for greater freedom in coding)
9:46 pm
That wraps up 2.5, Work Session 4 up next..
My brain has had it for awhile so that's it.
9:53 pm