generated from mwc/lab_names
Initial commit
This commit is contained in:
commit
6a14128f60
|
@ -0,0 +1,26 @@
|
|||
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Write your entire commit message above this line.
|
||||
#
|
||||
# The first line should be a quick description of what you changed.
|
||||
# Then leave a blank line.
|
||||
# Then, taking as many lines as you want, answer the questions
|
||||
# corresponding to your checkpoint.
|
||||
#
|
||||
# Checkpoint 1:
|
||||
# - What is the difference between a value and a name? Describe
|
||||
# a situation from everyday life where it's important to
|
||||
# distinguish between a name and the value it refers to.
|
||||
# - How might variables be useful in programming? In other
|
||||
# words, why might you want to use a name rather than just
|
||||
# using the value that it refers to?
|
||||
#
|
||||
# Checkpoint 2:
|
||||
# - How is a function like a variable?
|
||||
# - One of the most important problem-solving strategies in CS is
|
||||
# breaking down big, hard problems into lots of small, easy problems.
|
||||
# How might functions be useful in breaking down big, hard problems?
|
||||
# Can you think of an example?
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
**/__pycache__/
|
|
@ -0,0 +1,6 @@
|
|||
# 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? "))
|
|
@ -0,0 +1,32 @@
|
|||
# draw_with_shapes.py
|
||||
# -------------------
|
||||
# By MWC contributors
|
||||
|
||||
from turtle import *
|
||||
from shapes import triangle, rectangle
|
||||
|
||||
def flyto(x, y):
|
||||
penup()
|
||||
goto(x, y)
|
||||
pendown()
|
||||
|
||||
flyto(-100, 0)
|
||||
triangle(40)
|
||||
triangle(60)
|
||||
triangle(80)
|
||||
triangle(100)
|
||||
flyto(100, 0)
|
||||
rectangle(10, 90)
|
||||
rectangle(20, 80)
|
||||
rectangle(30, 70)
|
||||
rectangle(40, 60)
|
||||
rectangle(50, 50)
|
||||
rectangle(60, 40)
|
||||
rectangle(70, 30)
|
||||
rectangle(80, 20)
|
||||
rectangle(90, 10)
|
||||
hideturtle()
|
||||
input()
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# greetings.py
|
||||
# ------------
|
||||
# By MWC contributors
|
||||
|
||||
my_name ="Chris"
|
||||
greeting = "Hello, " + my_name
|
||||
print(greeting)
|
|
@ -0,0 +1,20 @@
|
|||
[project]
|
||||
name = "lab-names"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = [
|
||||
{name = "Chris Proctor",email = "chris@chrisproctor.net"}
|
||||
]
|
||||
license = {text = "MIT"}
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10,<4.0"
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.poetry]
|
||||
package-mode = false
|
|
@ -0,0 +1,11 @@
|
|||
# shapes.py
|
||||
# ---------
|
||||
# By MWC contributors
|
||||
|
||||
from turtle import *
|
||||
|
||||
def triangle(side_length):
|
||||
pass
|
||||
|
||||
def rectangle(height, width):
|
||||
pass
|
|
@ -0,0 +1,19 @@
|
|||
# test_shapes.py
|
||||
# --------------
|
||||
# By MWC contributors
|
||||
|
||||
from turtle import *
|
||||
from shapes import triangle, rectangle
|
||||
|
||||
def flyto(x, y):
|
||||
penup()
|
||||
goto(x, y)
|
||||
pendown()
|
||||
|
||||
flyto(-100, 0)
|
||||
triangle(100)
|
||||
flyto(100, 0)
|
||||
rectangle(20, 80)
|
||||
input()
|
||||
|
||||
|
Loading…
Reference in New Issue