In this blog post I will discuss my first impression of the online course ‘An Introduction to Interactive Programming in Python’ and my experience the first two weeks in the course. In week one I became familiar with the course site and learned about CodeSkulptor (website where we write and implement Python code), comments, print, arithmetic operators, operator precedence, variables, and how to submit, save, and export code in CodeSkulptor. I have included a sample of some of my notes for week one at the end of this post. While optional, I completed the mini-project for week one titled “We want a shrubbery! …”. This project involved creating a program in CodeSkulptor that prints out the phrase “We want… a shrubbery!”. My primary motivation for completing the project was to become comfortable with the logistics of the submission and peer assessment process. In week two I learned about functions, visualizing functions, additional operations (modular arithmetic, data conversion, and comparison), Python modules, logic, and conditionals. I have included a sample of some of my notes for week two below. The mini-project for week two was titled “Rock-paper-scissors-lizard-Spock” and involved the creation of a program that displayed five player choices (i.e. rock, paper, scissors, lizard, and Spock) with five randomly selected ‘computer’ choices, computed a winner, and displayed this winner to the user. This involved the creation of functions to convert choices into numbers and vice versa for computing a winner and displaying selections. Computing a winner and displaying selections took place in a different function that made use of random.randrange() to determine random computer choices and if/elif/else statements to determine the winner. The rules of Rock-paper-scissors-lizard-Spock are:
While it is too early to fully evaluate this course and the accompanying learning process, I believe this course has so far been effectively set-up and delivered to suggest those taking it will have an effective and enjoyable experience learning Python. Some observations that contributed to this assertion include:
- Familiarity breeds habit.
- Marking mini-projects reduces the workload of professors. This seems especially beneficial as this course is provided free. - Marking the work of others fosters those connections between students that may be less prevalent in online courses.
Overall I have had a very positive experience the first two weeks of class and my impression of MOOCs (Massive Open Online Courses) has definitely been improved as a result. If this course is a good representative of MOOCs, then I think MOOCs stand a good chance of altering postsecondary learning and easing the process of lifelong learning for the better. Thanks for taking the time to read my post. If you have any questions, comments, or suggestions please share them below. Week 1 Note Sample Arithmetic Operators + plus addition - minus subtraction * times multiplication / divided by division ** power exponentiation Operator precedence – “please excuse my dear aunt sallie” = (), **, *, /, +, - Always manually group using parentheses when in doubt. Variables = Placeholders for important values.
Assign to variable name using single equal sign (=).
Week 2 Note Sample
Functions Function = Piece of code that you define that you can execute later. You only execute the code inside a function when you call a function. You can call a function more than once. Basic Function Form Def function(variable(s)): equation return output Note: Inside a function you can call another function. Visualizing Functions using Viz Mode in CodeSkulptor Viz mode records a trace (sequence of statements) of the execution of your program. When a particular statement is highlighted in this trace using the navigation buttons the contents of the console (upper right) and the state diagram (lower right) corresponds to the state of your program prior to execution of the highlighted statement. Modules Python Modules = Extra functions implemented outside basic Python. import simplegui # Access to drawing operations for interactive applications. import math # Access to standard math functions, e.g. trig import random # Functions to generate random numbers. Randomly Select Element in Range: random.randrange() In Python the statement ‘import’ is used to load a module. More Operations Remainder – Modular Arithmetic a % b % computes the remainder of one number with respect to another. Note: The % operator has a higher precedence than the + operator. Operator ‘str’ converts something into a string. Logic and Comparisons Boolean Logic = Logic where all values can either be true or false. No grey area. Not X = Value is opposite of X. And = If both values are True, then together they are True. If any value is False, then together they are False. Or = If both values are False, then together they are False. If any value is True, then together they are True. Comparison Operators > = Greater Than < = Less Than >= = Greater Than or Equal To <= = Less Than or Equal To == = Equal To != = Not Equal To Allows you to take two values, compare them to each other, and generate a Boolean. Conditionals if x: code here The above functions such that if x is true, then the following indented code will be implemented. if x: else: If the predicate x is true, then indented code after ‘if x:’ will be executed and if it is not true, then the indented code after ‘else:’ will be executed. elif y: Means else if: If ‘if’ was false, but ‘elif:’ is true, then indented code after ‘elif:’ will be executed.
0 Comments
Leave a Reply. |
Categories
All
Archives
May 2025
Insights and Innovations Across the UniverseDelve into the realms of AI, astronomy, and philosophy. |