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
2025-08-30 01:11:49 +00:00
2025-08-30 01:11:49 +00:00
2025-09-07 17:43:20 -04:00
2025-08-30 01:11:49 +00:00
2025-09-07 17:43:20 -04:00
2025-09-07 17:43:20 -04:00
2025-08-30 01:11:49 +00:00
2025-08-30 01:11:49 +00:00
Description
No description provided
28 KiB
Languages
Python 100%