For this task we had to do certain practical programming tasks, that would enable us to understand more about Boolean Expressions. If you are not familiar with Boolean Expressions, it is really about writing a road map on True and False statements. To read more about this, click here.

First we had to create a program that prints the numbers 1 to 10 to the stream (Console window of PyCharm). This is how it turned out:

AS05_1

The second task was to create a program that looped and kept asking the user for numbers – until the user enters 0 and then the program breaks and sums up all the numbers. The program should then print the result. This is what the code looks like:

AS05_2

The third task was a fun one. As a programmer you sometimes get “locked in” into your project, making the hours tick by without you being aware of the time. This can cause several health issues and leave you very tired at the end. All computer workers should once an hour get up from the chair and do some activities. The program we were supposed to write, was a program that once an hour opens up a window in your default browser, goes to Youtube and plays a music video. Every time you run the program you are asked how many times the alarm should run, how often it should run (pause in between) and what music video you want to play. Once these flexible variables are entered – the program will run until the loop breaks. This is how the program looks like:

AS05_3

For the fourth and final task, I had to create a Number Guessing game. In order to do this you needed to make a program that first of all makes the computer create a given random number between a certain range, and then when running the program – making the program break if it is the correct guess. I added a little extra functionality, making the user have to guess the correct answer within 5 tries (not in the screenshot). This is how the code looks like:

AS05_4