From ab6c453892297b4403d62353ce08c0f603e12654 Mon Sep 17 00:00:00 2001 From: Cory Dean Chung Date: Wed, 19 Jul 2023 16:20:02 -0400 Subject: [PATCH] In greetings.py, I changed the first line to my_name = input("What is your name?") as instructed. In circle_area.py, I finished the program by assigning 3.141592653 to pi and then printing the value of pi * radius * radius, which is the area of a circle. Checkpoint 1: A value is what it is, but a name refers to a value. An everyday life situation where it's important to distinguish between a name and the value it refers to is when multiple people have the same name. For example, I went to high school with two people who were both Kevin Ng. Despite the jokes, they weren't interchangable, and the relationships I had with each were different. Variables can be useful in programming for a number of reasons. In the assignment text, pi was assigned the value 3.141592653. pi is much quicker and easier to type. Another reason a variable might be useful is because the value a name refers to might change. For example, the price of a fruit might change from $1 to $2, but we'd still refer to monetary amount as price. Checkpoint 2: Not there yet! Was asked to submit at checkpoint 1. --- circle_area.py | 2 ++ greetings.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/circle_area.py b/circle_area.py index 513d6f7..8ac6a61 100644 --- a/circle_area.py +++ b/circle_area.py @@ -4,3 +4,5 @@ print("This program will calculate the area of a circle.") radius = float(input("What is the circle's radius? ")) +pi = 3.141592653 +print(pi * radius * radius) \ No newline at end of file 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)