generated from mwc/lab_names
functions and loops. I modified the greeting program. Checkpoint1: A value is what something is and a name represents the value. For istance when we talk about pi, we just say the name pi, but the value is 3.14.. Variables are extremely useful in programming in order to minimize confusion, it helps to not use literals when possible. For instance if I am programming an arduino, I set a pin value so that if I change my circuit I dont need to rewrite that pin value all over my program, I instead use a variable to represent the pin value so I only need to change the variable line. Variables in code are useful and are reusable values that allow us to speed up programming, make code more readable and more efficient. Checkpoint2: A function is like a variable in several ways, you need to define the function (just like when you write a variable), functions are used to make repeatable, clean lines of code that reduce confusion. Functions actually allow for their own in-block temporary variables called "parameters", paired with arguments they give functions great flexibility and power. Functions are useful to do many different things in a program. For instance if I wanted to use several different area formulas, we might want to break them down into seperate functions. Or we can use functions inside of one another to make code cleaner and easier. |
||
---|---|---|
.commit_template | ||
.gitignore | ||
circle_area.py | ||
draw_with_shapes.py | ||
greetings.py | ||
pyproject.toml | ||
shapes.py | ||
test_shapes.py |