The document is a final report for a laboratory activity on basic Python syntax, variables, data types, and casting. It summarizes two activities - one using Karel the Robot to create a student's middle initial using beepers, and another calculating and printing the volumes of different shapes using formulas. For the Karel activity, students had to write code in Spyder to run Karel and illustrate their initial. For the volume activity, students used Jupyter Notebook to input variables, formulas, and print outputs for a cube, rectangular prism, cylinder, cone, and sphere. The report includes the objectives, materials, procedures, problems, analyses, algorithms, and source codes for both activities.
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
_MODULE1_FINALPAPER.docx
1. DE LA SALLE UNIVERSITY
2401 Taft Avenue, Manila
LBYCPA1
LABORATORY ACTIVITY #1
(Basic Syntax, Variables, Data Types, Numbers, and Casting)
FINAL REPORT
LAST NAME, FIRST NAME M.I.
EQ4/MMW; 11:00-2:00
Submission Date: April 24, 2021
Ms. Blanca Bucao
Instructor
2.
3. I. Laboratory Activity Title
The module 1 laboratory activity is titled Basic Syntax, Variables, Data Types, Numbers, and
Casting
II. Objectives
With this Module and Lab Activity, the students are expected to learn/accomplish the
following:
1. To learn to install and set-up Anaconda, Anaconda Prompt, Anaconda Navigator,
Stanford Karel, Spyder, and Jupyter Notebook.
2. To understand the basic concepts in programming.
3. To utilize formulas for computation in Python.
4. To learn the application and utilization of Phyton.
5. To illustrate how to use equations in software like Jupyter Notebook.
6. To learn the basic commands in Stanford-karel.
III. Materials, Software Tools, and Procedure
1. Anaconda Navigator
2. Jupyter Notebook
3. Stanford Karel
4. Spyder
5. Draw.io
Procedure
Karel the Robot
In activity 1, the students were tasked to write Python script where Karel creates your
middle initial using beepers. To accomplish this activity, stanford-karel must be run in the
Spyder software, located in Anaconda Navigator. Certain codes must be inputted first on the
Spyder so that stanford-karel could run. Once the program is running, the students must view
the karel website to see all the available commands that can help us accomplish this activity.
After inputting the codes, save the code and run the program. If there are any errors, simply
fix the code then reset and run the program. The final product must be beepers with a pattern
of your middle initial.
Volume
In activity 2, the task is to compute and print the resulting volume of each of the inputs of
the shapes, namely cube, rectangular prism, cylinder, cone, and sphere. To do this, the
students must first open Jupyter Notebook, located on Anaconda Navigator. Once the
program is opened, fill up the asked information and input the given formulas (Figure 1) for
4. each shape. In this activity, several different formulas have been used since there are a total
of five distinct shapes. Save and run the program to see if the printed output is correct or has
any errors. If the program has errors, just thoroughly check the spelling and the use of each
code. Test and run the programs over and over until you’ve reached the correct printed
output.
Rectangular Prism
Let l = length of the sides
Let h = height of the rectangle
Let w = width of the sides
Vrectangularprism = l*w*h
Cube
Let a = length of the edge a side of the prism
Vcube = 𝑎3
Cylinder
Let r = radius of the circular face
Let h = height
Vcylinder = 𝜋𝑟2
ℎ
Cone
Let r = radius of the circular base
Let h = height from the base to the tip
Vcone = (1/3) 𝜋𝑟2
ℎ
Sphere
Let r = radius
Vsphere = (4/3) 𝜋𝑟3
IV. Problem (Machine Problem/Lab Activity Problem)
1. Activity 1: Karel the Robot- Write a code that illustrates the student’s middle initial using
beepers.
2. Activity 2: Volume Computation: Write a code that shows the printed output of the
volume of the five shapes: Cube, Rectangular Prism, Cylinder, Cone and Sphere.
V. Problem Definition/Analysis
Karel Robot
There are two given problems for the students. The first one was titled “Karel the Robot”.
It made the students use the following software: Spyder, Anaconda Navigator, Stanford-
Karel. The task given was to illustrate their middle name in Karel robot using beepers. Good
thing that the teacher provided a website wherein the students can see all the available
commands that can be used. Several testing and adjusting was done to make sure that the
5. beepers were at their proper place, allowing the Karel robot to illustrate a well-presented
middle initial.
There are two given problems for the students. The first one was titled “Karel the Robot”.
It made the students use the following software: Spyder, Anaconda Navigator, Stanford-
Karel. The first step to open Stanford karel is by opening Spyder. After opening spyder, the
student must input phrases that will allow the spyder to run Stanford karel. Once this is done,
the student can now put commands to test their karel.
The installation and testing of the karel is now done. The student can now put his
commands to put a letter “C” pattern made of beepers. The figure below will illustrate how karel
should run to perform a C pattern.
6. To do the figure above, a set of commands available at the Karel website was given by
the teacher. As seen in the illustration above, the student started first from right to left rather than
left to right. The reason being that since the pattern is letter C, if the student goes from left to
right to put beepers, the student cannot go in upward motion because if he/she does this, the
letter C would become inverted. Hence, the student must start from right to left to prevent not
going back again to start its upward motion.
In this activity, there are only three lines that are formed. First is the horizontal line to
make the first part of the C. The commands used are: twelve move(), five turn_left(), and six
put_beepers(). The second line is the vertical line that forms the second part of the C. The
commands used are: seven move(), three turn_left(), and six put_beepers(). The last or third line
is the horizontal to complete the pattern C. The commands used are: six move(), and six
put_beepers(). The figure below will be the result of the said used commands.
7. Volume Computations
The second problem was titled “Volume”. It tasked the students to make a program that
prints the computed volume of each shape. In the problem there were five shapes, namely: cube,
rectangular prism, cylinder, cone, and sphere. To start on this activity, students must first open
Anaconda Navigator, to open Jupyter Notebook.
Before learning to input the numbers and formulas, students should first learn to input a
variable and print the output. The students assigned “float” in their variables so that numbers
with decimals can be inputted. The students also placed “input” in their code since there is a
number that needs to be placed in order for the volume to be computed. Lastly, when printing the
output of the computation, the students need to declare how many decimals places in the output.
This was done by the students by inputting “{0.2f}” in the output. With this, it showcased output
with only two decimal places. The number of decimal places can be changed by changing the
number in the code. For example, “{0.4f}” the output of this code will now show 4 decimal
places.
The computation part was easily done since the teacher gave all the necessary formulas
needed in the problem. The students were reminded by the teacher to be very aware and critical
in coding, since one error can lead to the failure of the program. Each shape has a different
output since all of them has distinct formulas. Several trial and errors are done in this activity to
8. make sure that the printed output of each shape is correct. The shown figure below are the used
variables and formulas in the activity.
VI. Algorithm
Activity 1: Karel the Robot
Initial State
9. Final State
1. Open Spyder and input the necessary codes to run Karel Robot.
2. Move the Karel forward six times to start from right to left.
3. Make the Karel turn 270 degrees by making it turn left three times.
4. Start putting beeper continuously in every move.
5. Start moving to the left.
6. When the Karel is at the end of the wall. Start making it go up by first turning it to 270
degrees then moving up in a vertical direction.
7. Input the commands that illustrates a straight horizontal line.
8. Once the Karel is at the top of the wall. Make it turn 270 degrees.
9. Move the Karel to the right in a straight horizontal direction.
10. Stop until the sixth move. This is the end of the program
11. Test the program again and again to make sure there are no errors.
Activity 2: Volume
Algorithm 1: Rectangular Prism
1. Input the variables: l, w, h.
2. Place the formula: l*w*h
3. Print the output volume.
Algorithm 2: Cube
1. Input the variables: a
2. Place the formula: 𝑎3
3. Print the output volume.
10. Algorithm 3: Cylinder
1. Input the variables: pi, r, h
2. Place the formula: 𝜋𝑟2
ℎ
3. Print the output volume.
Algorithm 4: Cone
1. Input the variables: pi, r, h
2. Place the formula:
1
3
𝜋𝑟2
ℎ
3. Print the output volume.
Algorithm 5: Sphere
1. Input the variables: pi, r,
2. Place the formula:
4
3
𝜋𝑟3
3. Print the output volume.
VII. Flowchart
Activity 1: Karel Robot