generated from mwc/lab_names
A value is something we want to use, either a number or an equation. A name is a what we use to refer to that value. A real life situation that comes to my mind, is a shopping cart, the value is something you push around a grocery store to collect grocery items. The name in my area is a shopping cart but i have heard others call it a buggie, a trolley, or a carriage, as the name of something can be changed. If you are using a name to refer to an equation like we did with the area of a circle, equations can get quite long and complicated to write, especailly on a computer, naming allows you to write it once but use it over and over again quickly and easily. It is exactly the same but instead of recalling one thing, it recalls a bunch of things to do together I would guess that we could use functions together for a big problem, solve one little problem with one fuction, a different little problem with a different function and so on I am having trouble thinking of an exmaple of this right now, but i look forward to learning one.
10 lines
239 B
Python
10 lines
239 B
Python
# circle_area.py
|
|
# --------------
|
|
# By MWC Contributors
|
|
|
|
print("This program will calculate the area of a circle.")
|
|
radius = float(input("What is the circle's radius? "))
|
|
pi = 3.142592653
|
|
circle_area = pi*radius*radius
|
|
print (circle_area)
|