Sunday, July 28, 2019

My Third Python Course


             The third Udacity course my dad had me take gave me lots of new Python knowledge. It blended my two last courses  and filled me with new knowledge, and helping me to understand Python better.
             I think this course was really engaging and I learned lots. I liked how some of it was review and some of it was new, because it made me think in different ways.
             I learned how to use Booleans, which are a kind of data that compare using true or false. There's <  for less than, > for greater than, <= for less than or equal to, >= for greater than or equal to, == for equal to, and != for not equal to. This can be used in lots of ways, like for checking whether an answer is right or wrong, or if an object is one or the other.
             I learned about break, too. The break keyword will stop a loop once the program detects that a certain condition has been met. 
             I also learned about variable scope, which refers to specific parts of a program a certain variable can be used in. For example, a variable created inside a function can only be used inside that function. But if a variable is created outside a function, it can be used anywhere in the program, which I thought was interesting.
             What I also learned was lists, types of data that can be defined as variables that have inside them a list of strings. It's defined with square brackets, and always has in it data separated by commas. They have a specific order, and can be looked up by their number in their sequence.
             One thing my second course taught that this course didn't was how to connect python with the outside world, like opening up web browsers, but this course was nevertheless extremely fun and useful, and it makes me very excited for whatever I will learn next.
List Example

Saturday, July 6, 2019

Project Idea

             Since I learned so much about Python through my Udacity courses, my dad suggested that I share some of the enriching ways to code that I learned. So, in this post I will walk through how I would program my computer to alert me on the day a movie I want to watch comes out in theaters, an idea I got from my second Udacity course.
             As an example, I will code the program to alert me in four days by opening a browser that shows the date that the movie comes out.
Step 1
             The first thing I will do is use a really useful function called "webbrowser.open," which will control the browser that will come up when the movie comes out. I've used youtube as an example, but a more specific link can be put there instead.
Step 2
             When I've tested this code and made sure that it works, I will move on to control how long the program will wait before opening this browser. I will use the "time.sleep" function to make the program wait for eight seconds first, to test the program easier.
Step 3
             Once I'm sure that the program works, I will now make the program wait four days. Since the computer counts time in seconds, I multiply the numbers to make the program wait the right length.
             If I want to have the program remind me every day after that for four days, I can also add a loop to my code.
Step 4
             There are lots of other ways to use these same functions, and that's one of lots of reasons I like Python. Making this code reminds me of all the possibilities learning Python opens up, and it makes me feel empowered.