Python Lesson 1, Reflection

Screen Shot 2016-10-04 at 8.04.58 PMIn this class, I learnt a lot about how to code in Python. Since I have never coded in Python before, pretty much everything that was taught this class was brand new to me.

The first function that I learnt was the ‘print’ function. When you play some code that uses ‘print’ with text in quotation marks, the output is exactly what you put inside the quotation marks. Apart from printing text word for word, this function can also solve some mathematical equations. If you don’t add quotation marks in put in a mathematical expression, the code will automatically calculate it for you in the output.

Apart from the print function, I also learnt how to define and use a variable in code. When you have an output that depends on what the user types in, you will need to use a variable. It is easier to name the variable accordingly, so that you can easily identify what the variable represents when you go back and look over your code. Once you have defined your variable, you have to use the same name for all of your lines so that the system recognizes them as the same.

So, how are users supposed to communicate through the code in order to define the variable. For this, you will need to use an input function. The input function allows the user to type in a response to the question asked by the code. This way, it can be more interactive and fitting to the user’s needs; such as asking them which times table they would like to learn.

Lastly, I also learnt about strings and integers and what sets them apart in Python. Integers are whole, negative or positive numbers. Strings, on the other hand, are bits of text that the system recognizes to be printed. In order to tell the system that, you insert quotation marks before you print.


Leave a Reply