Assignments


In this page, you will explore some of the tasks that I do everyday. Press to "Open in Replit Button" and press "Run" to see the code in action.


×
Home About Me Assignments Projects

Description


The task was to write a program that outputs a joke on multiple lines.


Reflection


It was a fairly easy task so I challenged myself to make the joke delayed to create a suspense effect. I imported the time module and used the built in function sleep to create the suspense I wanted.


Description


The project had 3 levels. I was instructed to create 2 variables with a name and favorite food.


Reflection


It was nice to get challenged and to create complex sentences as the task progresses. It was fun to explore escape sequences and how to manipulate variables.

Description


We were introduced to the builtin function, input, and were told to make a questionnaire that will take the users’ answers and output a summary with all of the answers.


Reflection


I really enjoyed this exercise because I had liberty to create my own questions and create a fun quiz. I'm the future, I would have made the questions in depth. I am happy that I got to explore the time module.

Description


It was a do now in which the class was assigned. We had a total of 5 tasks. Each task was different.


Reflection


The first task was to ask for the user’s name and their favorite animal. The output should be: “Hello [name]. Your favorite animal is the [favAni]”. I was surprised it was a simple task. Making variables and putting the value into a sentence via concatenation was nice. The 2nd task was to ask the user to enter a number, then print that number again 3 times. I used the input function to get the value and cast the string to an integer. It was simple but the challenge was to remember to change the string to a number. The 3rd task was to ask the user to enter 3 test scores as integers. Then print out the average of the numbers. It was basic mathematics. It was fun because I like math. The 4th task was to ask the user to enter in 3 words, then print the words in reverse order. This was a simple task that was like the first problem. The last task was to ask the user to enter two integers. I should then find the area of the rectangle. My favorite part was to create a rectangle using dashes. It was easy to complete the task. Overall, this was a good assignment for practicing the skills we have learned.

Description


We explored the built-in functions of the math module. Some examples are squareRoot, absolute value, power, sum, subtraction, division, and multiplication. After that we did a practice run of how we can use math in code.


Reflection


It was a fun session that the entire class partook in together. I was excited to learn about importing modules. Since Mathematics is one of my favorite subjects I was elated to see how I came to use python to solve problems like addition, absolute value, square root and more. It was hard to learn the different symbols of the mathematics functions but I did and used them in practice code.

Description


I modified the code to make it more personalized to the user and add and multiply numbers that are given to it.


Reflection


I liked this assignment because editing the code gave me a feeling of pride that I know what I am capable of doing. The challenges were fun to answer and gave me a chance to explore calculations more in depth. If I had to edit the code, I would have made the quiz more personal and tell the user what they are doing.

Description


We created different type of calculators.


Reflection


This was one of my favorite assignments during the term because I made different calculators. The calculators were: Area Calculator, Perimeter Calculator, Tip calculator, and a Volume Calculator. The area of a rectangle calculator was easy because I have already completed the assignment in DONOW U1L11. It was a good refresher on all of the concepts that I had learned early in the year. The perimeter of a rectangle calculator was a challenge because I forgot how to find the perimeter but after I remembered it was simple to add all of the values and finding the perimeter of a rectangle by adding the length * 2 and width*2 was a breeze It was fun to add the rectangle shapes to the code. The 20% tip calculator was my favorite one to code because it gave me the most challenge. Percentage was not my favorite topic in Math and is a concept that I make mistakes on my times. I am proud that I was able to figure out how to calculate tips on the first try. Lastly, the Volume calculator was my least favorite because it was easier to do. I asked for 3 values and multiplied them together to the volume of a cuboid. If I could edit the code I would have made the user choose what calculator they would have liked to use. I am proud of my work and Iit is one of my prized projects.

Description


This program will define four subroutines - add, subtract, multiply, divide that add multiply. Two numbers and return the result. Each should have two integer number arguments. The user is asked to input two numbers. These numbers will be passed as arguments into one of the subroutines. The user is asked to input 1 to add, 2 to subtract. If input 1, calls the ‘add’ subroutine, input 2 calls the ‘subtract’ subroutine. Output the returned result as part of a sentence.

Reflection


This project is in my top 3 favorite assignments that I completed this Term. I believe it is one of my most successful works because I created a fully functioning calculator using the math operators like addition, subtraction, multiplication and division. I very enjoyed testing my code in between and seeing that I worked. I was introduced to if statements that test is true or not. I like that the user has the ability to input the symbol of the operation and the math would still work. To strengthen the code, I would import the math module and add more operation like square rooting a number.

Description


I wrote a program called "Test Grader". The program should allow the user to enter a test mark between 1 and 100 If the number entered is too high or too low, a message should be displayed informing the user of this. I was to create a variable called Fail If the test result is less than 40 they have FAILED - assign the value “Y” to your Fail variable If the test result is greater or equal to 40, it is a PASS - assign the value “N” to your Fail variable Check the value of Fail - if it is NOT EQUAL to “N” print a message saying “Retake required” CHALLENGE The program should then also work out and print the grade as follows:
Under 40: A "U" grade
40 - 59: A "C" grade
60 - 79: A "B" grade
80 or over: An "A" grade


Reflection


I really enjoyed this project because I felt like a teacher that is grading students' work. The Challenge was my favorite part of the assignment because it made the program feel more like a Test Grader. The program that converts the numeric grade into a letter that represents whether they are passing or not and by how much. If I could edit the code I would make the program ask how many tests you would like to grade and find the average. Then it will give you the final score. The program help me see how IF ELSE statements are used in everyday lives and can be used to grade assignments.

Description


We had to modify the starter code. I had to add a line of code asking the user to enter a third number. I also had to edit the IF/ELIF/ELSE statements to confirm whether the third number is bigger/smaller/the same as the first number and whether it is bigger/smaller/the same as the second number. Also if all three numbers are the same.


Reflection


I like this project because it is a simple concept but it can be confused very quickly. I got confused on what numbers I am comparing. The code was repetitive so I would get the less than and greater than sign confused which caused confusion in my conditional statements and ultimately an error. This assignment made me pay closer attention to my code. It would have helped if I had commented on the explanation of the objective of the different lines.

Description


You are going to write a program called "Time Reminder"
The user has to enter a number between 0 and 23
If the number is less than 8 display a message saying "too early to get up"
If the number is less than 12 display a message saying "Good morning"
If the number is less than 14, display a message saying "Lunch time!"
If the number is less than 18 display a message saying "Good afternoon"
If the number is equal to 18 display a message saying "Tea Time"
If the number is less than 19 display a message saying "Good evening"
If the number is less than 22 display a message saying "Nearly bedtime"
If the number is 23 display a message saying "Good night!"
Any other number is met with the response “Sorry, I don’t recognise that”


Reflection


This was one of the most complicated projects I have completed this term. We were instructed to make clocks. When the user inputs a time, the clock would remind the user what should occur at that time. The confusion occurred when all of the times were included except 8. I had to sweep through the code multiple times to see what was the reason for the error. Eventually, I found that a conditional was missing an “=”. Overall, it was an enjoyable project and a great practice for elif, if, and else statements.

Description


In the modified tasks, I was given some starter code. Use the instructions below to make changes to the code. I commented on my changes to explain what you have done. I adapted the code to get user input into the number variable. Then a change the print statement so it outputs 'number' multiplied by 'counter' equals 'product' Make the counter increase by 2 every loop Add a line once the loop has finished to output 'The loop has finished'


Reflection


The code was easy to do because it was Math based. It was tedious to write comments about everything but it really helped with me understanding the code better. If I could improve the code more, I would limit the number between 1 and 12 and if the user typed in a number below 1 or above 12 then the program would stop and tell the user to pick a number between the range.

Description


We are creating a login page. We have the correct password. The user is to input their username and password. If the user inputs the correct password, they will be able to login. If the user inputs the wrong password, they will be able to try again. They have 3 tries. If they fail they will have to restart the program.


Reflection


This was a good project because I got to explore the raise keyword so the login can stop after 3 tries. It was hard to initially stop the program after 3 times. As a result they researched and found out about the raise keyword. If I could edit the code, I would make the program start again so the user can retry.