Added variable "r" that calculates the area

Checkpoint 1:
- A value corresponds to something defined/fixed.
In comparison, a name refers to something that can
vary or be manipulated in some sort of way
In real life, one example is SSN. Everyone has a
distinct SSN (value). A person can move from their
hometown (name) where they received their SSN but
SSN will remain the same for all their lives.

-It's helpful to use variable in programming
because it allows us to use a value in different
contexts/calculations. It also makes it easier
for the author and the readers to understand
what the numbers represent if they are named as
variables.

Checkpoint 2:
-Function is more nested and can have different
elements within, such as a value or a variable or
another function. It is similar to a variable
in a way that it can correspond to a certain value
when executed.
-Along the similar lines as the answer above,
functions can help organizing our codes by chunking
our calculations. I recall creating a lot of
functions for my physics lab data analyses because
it involved multiple dimensions of calculations with
massive amounts of data. Labeling each (or a
certain chunk of) calculation(s) greatly helped me
keep track of my analyses.
This commit is contained in:
caglazir
2025-09-12 17:56:18 -04:00
parent 6fd5ddae88
commit daf916376a
3 changed files with 13 additions and 1 deletions

View File

@@ -2,5 +2,10 @@
# --------------
# By MWC Contributors
import math
print("This program will calculate the area of a circle.")
radius = float(input("What is the circle's radius? "))
r = round(((math.pi)*(radius)**2), 2)
r =str(r)
Area = "Area of the circle = " + r
print(Area)

View File

@@ -2,6 +2,6 @@
# ------------
# By MWC contributors
my_name ="Chris"
my_name = input("What is your name?")
greeting = "Hello, " + my_name
print(greeting)

7
poetry.lock generated Normal file
View File

@@ -0,0 +1,7 @@
# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand.
package = []
[metadata]
lock-version = "2.1"
python-versions = ">=3.10,<4.0"
content-hash = "7b8fc01b274bd807fb00372bbc8e138330f15ae7978ed61e180f3b17ec076725"