Learning Python – Day 2 !
Yesterday was a big day as I installed Python 3.7.0 on my laptop and I also wrote my very first program !
Downloading Python was dead easy so that only took me 5 minutes. I then had a look at some basic functions :
- print : literally show something on screen, e.g. print (‘hello’) write “hello” on the screen ,
- round(X,n) : rounds a number x to the n decimal
- input : let the program know that the user will input a value
- len : counts the number of letters in a word
To play with the functions, I used the Python shell. The shell is a window in Python that executes program. I understand what you typically do is open the shell, then open a new document and write your program there. You can then copy it into the shell to see it run. Pretty cool ! Check out my very first program below :
I had to debug it 4 times, which really cluttered my shell. There were lots of error messages and my screen didn’t look nice and clean. I then found that you can’t really clear the Python shell, your best option is to close it down and restart. I understand there is a Clear command that can help you achieve the same result but I didn’t quite understand how to use it so I just closed and reopened for now.
Here is what the program looks like when it runs
Pretty exciting huh !
How do I feel after Session 2 : quite excited as this was easy ! I know it won’t always be that way but it’s nice to start confidently ! Very motivated for tonight’s session !