From b4fcd7a205a9f2477274b23f64e0cb3f0e702980 Mon Sep 17 00:00:00 2001 From: Chris Mekelburg Date: Sun, 1 Sep 2024 16:17:25 -0400 Subject: [PATCH] circle area and name code updated checkpoint1 A name is different from a value because a value always has the same identity (2 is always 2 for example), while a name can be changed to refer to a different value. A name is a way to refer to a value, while the value is the true identity of the item. An example of a name would be UB and an example of its value would be a university composed of x buildings and y students in Western New York. Even if the name of the school changed, it would still be composed of the same buildings and students. Variables can be useful in programming when a value appears more than once in a block of code and you may need to later change that value. For example, you can run a motor by setting a command called motor_speed=value and then run that motor 10 different times in the code. If you later need to change the value of the speed, you only need to change the value in one place, where the variable is defined, rather than changing it each time the value appears in the code. --- circle_area.py | 3 +++ greetings.py | 2 +- poetry.lock | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 poetry.lock diff --git a/circle_area.py b/circle_area.py index 513d6f7..80ddb48 100644 --- a/circle_area.py +++ b/circle_area.py @@ -4,3 +4,6 @@ print("This program will calculate the area of a circle.") radius = float(input("What is the circle's radius? ")) +area = radius*radius*3.141592653 +print(area) + diff --git a/greetings.py b/greetings.py index 2d878a6..bd544b0 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..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"