3 Commits

Author SHA1 Message Date
mbhatti4
1f4c5b36d4 for the shapes lab, i wrote a code to draw
a signle triangle and rectangle
When i then ran the test_shape and draw_with_shapes, it produced the repeated shapes as in the lab instructions

Checkpoint 2:
Functions are like variables because both must be defined and called later to be used.
You define a variable with a value, and you define a function with a block of code by assigning a name to it.

If you have a bigger goal of a program, you can break down each step or portion of the code to make it easier to work with.
You can break down the big code into smaller tasks and write functions for each of those.
This way, you can tackle the problem in smaller, more doable blocks of codes/tasks.
It will also just make everything more organized and easier to read.
Instead of a whole code with lines of commands, having functions can split it up and make it easier to read.

An example wehre functions would be useful would be in a program that is a sort of escape room.
You can have a function for user input, then a function for what occurs in each room.
The benefit also is that you can create extra rooms that are not going to be used each time but only if the user answers the prompt in certain ways.
Overall, functions can make the bigger and harder code easier to do and understand, but it can also make more creative programs.
2025-09-07 18:25:29 -04:00
mbhatti4
4ee0167686 Greeting and circle area
In the greetings code, I added in the input line so when the code is ran, it asks the user for their name.
I then assigned the input to a variable so it can print out the input at the end
For the circle lab, i created a variable "pi" to assign the value of 3.14159265359 to it. I then created a variable to make a math sentence to compute the radius with the given radius.

Checkpoint 1:
A name is a varaible, and it refers to something. It is the label of the value. The value is the actual data that is stored in the name.
-> name = value
An everyday example of name and value would be in math where you can variables that represent certain values.
For example, in the area formula of a triangle, the varaible b represents the name "base". The value of the is whatever the base of the triangle is.

Variables can be useful in programming, rather than just using the value itself, because it will help keep your codes less repatiative.
You could create a varaible and use the name of it in later lines with more ease.
It overall would make the code less repatitve.
Variables are also useful because you can change and reassign the value to the name.
If at an earliar line you assign some value to a name, you can later alter that value by reassigning that name to carry out the rest of the program.
2025-09-07 17:43:20 -04:00
771bb77d66 Initial commit 2025-08-30 01:11:49 +00:00