generated from mwc/lab_names
Checkpoint 1
I changed the greeting to work with any person, and I modified the formula for circle_area in order to calculate the area of a circle regardless of the radius provided. A great distinction between a name and a value would be referring to a person's name versus their age. Their name can change as mentioned in the directions, but they are still the same person regardless. However, a person cannot change their age because it is a fixed rate that determines how long that person has been alive for. Variables, on the other hand, are potentially the most useful items I have come across in CS. A variable can save an immense amount of time for those working on the code as it can condense long lines of code into a single term or phrase. It also prevents any potential repeat and can be easier to naviagte and manage for bugs.
This commit is contained in:
parent
d5758b20d0
commit
1ca30b862b
|
@ -4,3 +4,6 @@
|
||||||
|
|
||||||
print("This program will calculate the area of a circle.")
|
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
|
||||||
|
circle_area=pi*radius*radius
|
||||||
|
print(circle_area)
|
|
@ -2,6 +2,6 @@
|
||||||
# ------------
|
# ------------
|
||||||
# By MWC contributors
|
# By MWC contributors
|
||||||
|
|
||||||
my_name ="Chris"
|
my_name = input ("What is your name?")
|
||||||
greeting = "Hello, " + my_name
|
greeting = "Hello, " + my_name
|
||||||
print(greeting)
|
print(greeting)
|
||||||
|
|
Loading…
Reference in New Issue