Lab 2
Lab 2
Lab Requirements
PyCharm (IDE).
0.8392857142857143
Solution
o To:
o To:
( )
3- Print the decomposed equation.
o Note: do not treat it as a string (do not enclose it with quotation marks)
o print( ((9.5 * 4.5) - (2.5 * 3)) / (45.5 - 3.5) )
2
Phase 2: Implementation Phase:
1. Open PyCharm.
3
3. Then, name it “Lab 2”.
4. Then, the new project is created and opened. After that, you have to create a new
Python file inside the project to write the code on it.
5. Select the project name on the left menu, right click on it and select “New” → “Python
File”.
4
6. Then, name the new file “activity_1”, and click on “Python file”.
7. Now, the new file is created and opened. Write the code in it:
activity_1.py
1 '''
2 ( (9.5 * 4.5) - (2.5 * 3) ) Numerator
3 / Divided by
4 (45.5 - 3.5) Denominator
5 '''
6 print( ((9.5 * 4.5) - (2.5 * 3)) / (45.5 - 3.5) )
5
8. To run the file, right click on any area of the editor and click on (Run 'activity_1'), which
is the name of the file.
9. After that, PyCharm is going to run the file using the Python interpreter, and then
display the output of the file to you.
6
Problem 2 Programming Exercises (1.7)
( )
and ( )
2.9760461760461765
3.017071817071818
Solution
( )
b. To:
7
2- Decompose the second equation:
a. From:
( )
b. To:
8
4. Run the code:
9
Individual Activities (50 minutes)
45
Write a program that displays the area and perimeter of a circle that has a radius of 5.5
using the following formulas (Note: π = 3.14159):
95.0330975
34.55749
10
Extra Exercises (Homework)
11