Added documentation and information to the programs
This commit is contained in:
parent
ba1c8d6d86
commit
ca0492fb72
4 changed files with 70 additions and 0 deletions
18
homework06/git-practice/circle1.py
Normal file
18
homework06/git-practice/circle1.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Program circle1.py
|
||||||
|
|
||||||
|
startUpMessage = '''
|
||||||
|
This program calculates the area of a circle.
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
print(startUpMessage)
|
||||||
|
|
||||||
|
import math
|
||||||
|
PI = math.pi
|
||||||
|
|
||||||
|
radius = float(input("Enter the radius of a circle "))
|
||||||
|
|
||||||
|
area = PI * radius**2
|
||||||
|
|
||||||
|
print(f"The area is {area:.2f}")
|
||||||
|
print("\n")
|
||||||
16
homework06/git-practice/rectangle01.py
Normal file
16
homework06/git-practice/rectangle01.py
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Program rectangle01.py
|
||||||
|
|
||||||
|
startUpMessage = '''
|
||||||
|
This program calculates the area of a rectangle.
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
print(startUpMessage)
|
||||||
|
|
||||||
|
length = float(input("Enter a value for the length "))
|
||||||
|
width = float(input("Enter a value for the width "))
|
||||||
|
|
||||||
|
areaOfRectangle = length * width
|
||||||
|
|
||||||
|
print(f"Area = {areaOfRectangle:.1f}")
|
||||||
|
print("\n")
|
||||||
17
homework06/git-practice/rectangular-solid01.py
Normal file
17
homework06/git-practice/rectangular-solid01.py
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Program rectanglar-solid.py
|
||||||
|
|
||||||
|
startUpMessage = '''
|
||||||
|
This program calculates the volume of a rectangular solid.
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
print(startUpMessage)
|
||||||
|
|
||||||
|
length = float(input("Enter a value for the length "))
|
||||||
|
width = float(input("Enter a value for the width "))
|
||||||
|
height = float(input("Enter a value for the height "))
|
||||||
|
|
||||||
|
volumeOfRectangle = length * width * height
|
||||||
|
|
||||||
|
print(f"Volume = {volumeOfRectangle:.1f}")
|
||||||
|
print("\n")
|
||||||
19
homework06/git-practice/sphere1.py
Normal file
19
homework06/git-practice/sphere1.py
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Program sphere1.py
|
||||||
|
|
||||||
|
startUpMessage = '''
|
||||||
|
This program calculates the volume of a sphere.
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
print(startUpMessage)
|
||||||
|
|
||||||
|
|
||||||
|
import math
|
||||||
|
PI = math.pi
|
||||||
|
|
||||||
|
radius = float(input("Enter the radius of a sphere "))
|
||||||
|
|
||||||
|
|
||||||
|
volume = 4 / 3 * PI * radius**3
|
||||||
|
|
||||||
|
print(f"The volume of the sphere is {volume:.2f}")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue