generated from mwc/lab_names
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.
This commit is contained in:
parent
72636c9fa0
commit
bda9f1414c
|
@ -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)
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
Loading…
Reference in New Issue