From 3a280698a232efd5ef19884606896bc0a87954e5 Mon Sep 17 00:00:00 2001 From: Diana Panarello Date: Mon, 8 Sep 2025 17:54:17 -0400 Subject: [PATCH] I had to import math in order to determine the area. I then added the formula for the area of the circle, and defined pi. Checkpoint 1: A value is a number. For example, I gave pi a value of 3.14. A name is referencing a value. The name I gave the value 3.14 is pi. One example I thought of is the name of students. The students do not have a numerical value, however it is important to distinguish who you may be talking to as a teacher to two students who have the same first name. Variables store data in programming. It is helpful to use variables when you are using the same data more than once. It makes coding more efficient. Checkpoint 2: A function is like a variable because they can both be manipulated within a program. They can both also be stored within a program. I teach an introductory course on Javascript. There are no prerequisites, so we use functions to breakdown code into smaller pieces, easing the anxiety for new coders. For example, we use functions when defining operations like sum, then identify what sum is, then use console.log to print the sum of two integers. We have also used int for user input to find the sum of two integers. --- circle_area.py | 7 ++++++- greetings.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/circle_area.py b/circle_area.py index 513d6f7..241fee2 100644 --- a/circle_area.py +++ b/circle_area.py @@ -3,4 +3,9 @@ # 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? ")) +import math +pi = 3.14 +area = radius * radius * pi +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)