From 8447179a442b2772c07899cac2647cfd29a17940 Mon Sep 17 00:00:00 2001 From: Aminah Date: Tue, 22 Oct 2024 14:01:50 -0400 Subject: [PATCH] resubmitting it didn't work properly the 1st time --- circle_area.py | 3 ++ poetry.lock | 7 ++++ shapes.py | 23 +++++++++--- square.py | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 poetry.lock create mode 100644 square.py diff --git a/circle_area.py b/circle_area.py index 513d6f7..cc18596 100644 --- a/circle_area.py +++ b/circle_area.py @@ -4,3 +4,6 @@ print("This program will calculate the area of a circle.") radius = float(input("What is the circle's radius? ")) +pi=3.141592653 +area=pi*radius*radius +print (area) \ No newline at end of file diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..a9b0222 --- /dev/null +++ b/poetry.lock @@ -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" diff --git a/shapes.py b/shapes.py index 731ec39..f078af0 100644 --- a/shapes.py +++ b/shapes.py @@ -3,9 +3,24 @@ # By MWC contributors from turtle import * - + def triangle(side_length): - pass + forward(side_length) + right(120) + forward(side_length) + right(120) + forward(side_length) + right(120) + +def rectangle(width,height): + forward(width) + right(90) + forward(height) + right(90) + forward(width) + right(90) + forward(height) + right(90) + + -def rectangle(height, width): - pass diff --git a/square.py b/square.py new file mode 100644 index 0000000..c26c7b4 --- /dev/null +++ b/square.py @@ -0,0 +1,98 @@ +from turtle import * + +def square(side_length): + for _ in range(4): + forward(side_length) + right (45) + + +color ('red') +pensize (10) +speed (9) + +sizes = [20, 40, 60, 80, 100] +for size in sizes: + square(size) + penup() + right(90) + forward(20) + left(90) + pendown() + square(size) + penup() + right(90) + forward(20) + left(90) + pendown() + square(size) + penup() + right(90) + forward(20) + left(90) + pendown() + square(size) + penup() + right(90) + forward(20) + left(90) + pendown() + square(size) + penup() + right(90) + forward(20) + left(90) + pendown() + +from turtle import * + + +def rectangle(width, height): + + for _ in range(2): + forward(width) + right(90) + forward(height) + right(90) + + + penup() +color('green') +pensize(10) +speed(3) + + + +left(90) +pendown() +rectangle(width = 100, height=100) +penup() +forward(90) +pendown() +rectangle(width=100, height=100) + + + + + + + + + + + + + + + + + + + + + + + + + + +