generated from mwc/lab_names
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.
This commit is contained in:
parent
8da5e0f570
commit
b4fcd7a205
|
@ -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)
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
# ------------
|
||||
# By MWC contributors
|
||||
|
||||
my_name ="Chris"
|
||||
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