Monday 28 October 2019

Python - Day Thirteen (October)

WHAT I DID TODAY:


Today I've completed the lesson/unit 'A Day at the Supermarket.' I mainly did exercises requiring 'loops' and 'lists and dictionaries.' Loops allow us to go through all the elements in a list, and use other codes/functions to further expand to different types of commands. I've now completed 45% of the overall course after finishing this lesson.


45% COMPLETED

And as always, I was told to do a review/exercise on what I learned.

'AT THE SUPERMARKET EXERCISE'


In this exercise I had to list the prices of fruit at the 'market' and how much of it is in stock. Then I had to use the new 'loop' code I learned to print out the whole list.

CALCULATING COST

I had to do another exercise, and this one was basically the last exercise and it required me to use codes to calculate the costs.


WHAT I LEARNED:


The main thing that was the focus of the lesson, was just loops. I learned that one new code, but learned a few different ways that code could be used and implemented together with other codes and functions.

I will quickly explain what a loop is again..

  • I learned that the loop code uses for and in. You might have noticed the use of it in the photos above already. This command just goes through a list.
LOOP EXERCISE

And you can choose how to use the code. In this short exercise, all I had to do was print out the list.


  • Another way I found out you could use loop for was to print only certain things you want from a list. For example, in an exercise that I will show below, I had to make sure the command only printed out 'even' numbers from a set of numbers.
PRINTING OUT ONLY CERTAIN THINGS


WHAT I WILL BE DOING TOMORROW / NEXT TIME:


Next time I will be continuing on with the course as usual. I will be moving onto the unit named 'Student Becomes Teacher.'

NEXT COURSE PREVIEW

There are 9 lessons in total, and I am planning to go through all of it.


No comments:

Post a Comment

Adobe Photoshop - Day 10 (June Final Post)

WHAT I DID TODAY / WHAT I LEARNED: For my final project, I thought for a while about what I could do. Then I remembered a while back I saw ...