Learning to code in Python- Day 2 : download Python 3.7.0 and write my very first program !

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 :

2018-08-07 (7)

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

2018-08-08

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 !

2 thoughts on “Learning to code in Python- Day 2 : download Python 3.7.0 and write my very first program !

  1. To clear the shell I just press enter until all the gobbledegook disappears off screen 🙂 It has always bemused me that there is not a simple way to clear the shell screen. Knowing Python though, there is probably is a very good reason for it. Good luck for your next session.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s