From daf916376ad12cad23a771c02463d82fbaedfa29 Mon Sep 17 00:00:00 2001 From: caglazir Date: Fri, 12 Sep 2025 17:56:18 -0400 Subject: [PATCH] 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. --- circle_area.py | 5 +++++ greetings.py | 2 +- poetry.lock | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 poetry.lock diff --git a/circle_area.py b/circle_area.py index 513d6f7..30554df 100644 --- a/circle_area.py +++ b/circle_area.py @@ -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) \ No newline at end of file diff --git a/greetings.py b/greetings.py index 2d878a6..509bf48 100644 --- a/greetings.py +++ b/greetings.py @@ -2,6 +2,6 @@ # ------------ # By MWC contributors -my_name ="Chris" +my_name = input("What is your name?") greeting = "Hello, " + my_name print(greeting) diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..7e72dc6 --- /dev/null +++ b/poetry.lock @@ -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"