We predicted what would happen in this code if certain lines of code were altered. We also examined the many features and sections of the code.
-
Updated
Mar 17, 2024 - Python
We predicted what would happen in this code if certain lines of code were altered. We also examined the many features and sections of the code.
We are predicting what the code will do when it runs. The predictions should be added to the code as comments.
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.
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.
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. It will tell the user when they failed or passed and what letter grade they got.
Learn how to write and call basic subroutines.
We used comments to answer the investigation questions on the example code.
A program called "Time Reminder"
We are predicting what the code will do when it runs. The predictions should be added to the code as comments.
In this program we renamed the function so that it has a sensible name. Then it got the user to input a country. Store it in a variable. Call the function again with the variable as the parameter.
I was assigned to write a prediction of what it will do when it runs. The prediction should be added to the code as comments. Then I ran the code, comparing what happens to your prediction. Then I commented on the differences between my prediction and what actually happened.
You have decided to design a fashion chatbot that helps people pick out their fashion preferences. Your bot can gauge what types of clothes and accessories the user might like. Your chatbot should ask the user the following and then give answers depending on the answers the user inputs
The user is asked at the end if they guessed correctly. Then if they did, display a “Well done” message. If they didn’t, display a “Never mind” message. As well as checking whether the answer is too high or too low, add a line that checks whether the guess is equal to the answer and if it isn’t, displays a “Bad luck” message.
I used comments to answer the investigation questions on the example code.
Add a description, image, and links to the unit3 topic page so that developers can more easily learn about it.
To associate your repository with the unit3 topic, visit your repo's landing page and select "manage topics."