At the end of this lesson, you will be able to :
A1.4 demonstrate the ability to use Boolean operators (e.g., AND, OR, NOT), comparison operators (i.e., equal to, not equal to, greater than, less than, greater than or equal to, less than or equal to), arithmetic operators (e.g., addition, subtraction, multiplication, division, exponentiation, parentheses), and order of operations correctly in computer programs;
write a program that calculates the area and perimeter of a rectangle
With a pencil and paper, answer the following questions:
State the 2 audiences of someone's code.
What is a comment?
Write 1 example of a comment.
What is a shebang?
What is black? What does it do to your code?
Why is if __name__ == "__main__" necessary in Python?
What is cpplint? What does it do to your code?
how to write comments in Python
how to write comments in C++
black style checker in Python and cpplint style checker in C++
what is a shebang?
what is the purpose of: if __name__ == "__main__" ?
from the online book Computer Based Problem Solving by Patrick Coxall, read:
the 6 Steps to Solve a Problem are well known and used all the time
1. What is the problem? - What am I trying to find?
2. Make a model - Break the problem down into pieces.
3. Analyze the model - Understand what is really going on.
4. Find the solution - Find a solution to each piece of the problem.
5. Check the solution - Work through the solution and check for errors.
6. Document the solution - Ensure anyone can follow your steps
watch "Area & Perimeter of a Rectangle in Python"
calculate and display the area and perimeter of a rectangle that has a length of 5cm and a width of 3cm.
complete the Daily Assignment section in Hãpara Workspace for this day
if Hãpara is not working, make a copy of this document
move it to your IMH-ICS folder for this course
watch "Area & Perimeter of a Rectangle in C++"
create the "Area and Perimeter of a Rectangle" program in C++
you only have to do test cases once, not for each language
make sure to get the same result as your test cases