From e8c8d061a4dccfc7d533bd88223bcdea2fca0c60 Mon Sep 17 00:00:00 2001 From: Hope Date: Thu, 1 May 2025 23:08:15 -0400 Subject: [PATCH] designs now displayed with appropriate orientation value is a constant a name represents something else In my family we all have nicknames. My brother is named Ramiro, but we call him Pelon. My other brother Stewart is called Tui, my sister Regina is Nena. My husband thought that I had 6 siblings instead of 3. Both names respresent the one value of a person. Variables allow a user to provide a value on the fly or allow us to easily change the input to an equation. They also provide for more understandable code because we then know what the value may represent. 5 is not very informative. radius is more informative. A function can be defined and named like a variable A function can break down a problem by taking one part - in particular a repeatable part - and allowing that piece of the logic to happen within the function. Then we just call the function without having to worry about those details. It also allows us to break up the work. If we agree what functions need to be written and what we are expecting from them then we can let one person tackle each function and then call the as needed without having to worry about how it's all done on the inside. An example may be like a webservice to process a banking transaction. I can call a function and pass arguments of to account, from account and amount and the web service takes care of the details and just lets me know that it processed or didn't. Simple and secure! --- circle_area.py | 6 ++++++ greetings.py | 2 +- poetry.lock | 7 +++++++ shapes.py | 16 ++++++++++++++-- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 poetry.lock diff --git a/circle_area.py b/circle_area.py index 513d6f7..9c1e88b 100644 --- a/circle_area.py +++ b/circle_area.py @@ -4,3 +4,9 @@ print("This program will calculate the area of a circle.") radius = float(input("What is the circle's radius? ")) +circle_area = radius * radius * 3.14 +circle_areastr = str(circle_area) +radiusstr = str(radius) + +print ("The area of a circle with a raduis of " + radiusstr + " is " + circle_areastr) + diff --git a/greetings.py b/greetings.py index 2d878a6..37f42db 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) diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..1b77763 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand. +package = [] + +[metadata] +lock-version = "2.1" +python-versions = ">=3.10,<4.0" +content-hash = "7b8fc01b274bd807fb00372bbc8e138330f15ae7978ed61e180f3b17ec076725" diff --git a/shapes.py b/shapes.py index 731ec39..ac9b1ed 100644 --- a/shapes.py +++ b/shapes.py @@ -5,7 +5,19 @@ from turtle import * def triangle(side_length): - pass + forward (side_length) + right (360/3) + forward (side_length) + right (360/3) + forward (side_length) + right (360/3) def rectangle(height, width): - pass + forward (width) + right (90) + forward (height) + right (90) + forward (width) + right (90) + forward (height) + right (90)