From bda9f1414c710e81a47e40a3cfc0dbe3366fdbf6 Mon Sep 17 00:00:00 2001 From: Rebecca Hankey Date: Tue, 10 Sep 2024 20:43:35 -0400 Subject: [PATCH] I changed the input function to get the value of the radius from the user. Then I established the variable for pi as 3.141592653. Then I established a variable for area. It became pi * radius * radius. Finally Print area prompted the program to calculate. The best way I can describe it is that a vlue is the thing and the name is what we call it. Therefore, a name does not necessarily need to relate to the thing itself, rather it is simply what we refer to it as. One example of distinguishing the name from the value is with parents. While their names may be something like Susan and Jim, the value assigned to them by us (their children) is mom and dad. Variables are useful in programming because it makes things more adaptable. When complex data or code is housed in variables, it becomes flexible in that one does not have to complete extensive work every time it is called upon. --- circle_area.py | 5 ++++- greetings.py | 4 ++-- poetry.lock | 7 +++++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 poetry.lock diff --git a/circle_area.py b/circle_area.py index 513d6f7..2945a92 100644 --- a/circle_area.py +++ b/circle_area.py @@ -3,4 +3,7 @@ # By MWC Contributors print("This program will calculate the area of a circle.") -radius = float(input("What is the circle's radius? ")) +radius = float(input("What is the circle's radius?" )) +pi = 3.141592653 +area=pi * radius * radius +print (area) \ No newline at end of file diff --git a/greetings.py b/greetings.py index 2d878a6..121c46d 100644 --- a/greetings.py +++ b/greetings.py @@ -2,6 +2,6 @@ # ------------ # By MWC contributors -my_name ="Chris" -greeting = "Hello, " + my_name +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..a9b0222 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +package = [] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "53f2eabc9c26446fbcc00d348c47878e118afc2054778c3c803a0a8028af27d9"