Added Lecture code 2025 0923
This commit is contained in:
parent
2ea176e6ec
commit
8b1c9656c6
8 changed files with 120 additions and 4 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -107,10 +107,8 @@ ipython_config.py
|
|||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
.pdm-python
|
||||
.pdm-build/
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
@ -160,5 +158,6 @@ cython_debug/
|
|||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
.idea/
|
||||
.DS_Store
|
||||
|
||||
|
|
16
bigos/lecture20250923/circleArea01.py
Normal file
16
bigos/lecture20250923/circleArea01.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Program: circleArea01
|
||||
# Objective: Calculate the area of a circle using floats.
|
||||
# Author: Edward Bigos
|
||||
# Date: 2025-0923
|
||||
|
||||
print("\nCalculate the area of a circle\n")
|
||||
|
||||
PI = 3.1415
|
||||
|
||||
radius = float(input("Enter a value for radius: "))
|
||||
|
||||
area = PI * radius * radius
|
||||
|
||||
print("\n")
|
||||
|
||||
print(f"The area of circle of radius {radius} is {area}")
|
19
bigos/lecture20250923/circleArea02.py
Normal file
19
bigos/lecture20250923/circleArea02.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Program: circleArea01
|
||||
# Objective: Calculate the area of a circle using floats.
|
||||
# Author: Edward Bigos
|
||||
# Date: 2025-0923
|
||||
|
||||
import math
|
||||
|
||||
print("\nCalculate the area of a circle\n")
|
||||
|
||||
PI = math.pi
|
||||
print(f"PI is {PI}")
|
||||
|
||||
radius = float(input("Enter a value for radius: "))
|
||||
|
||||
area = PI * radius * radius
|
||||
|
||||
print("\n")
|
||||
|
||||
print(f"The area of circle of radius {radius} is {area}")
|
16
bigos/lecture20250923/reactangleArea03.py
Normal file
16
bigos/lecture20250923/reactangleArea03.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
# Program: rectangleArea03
|
||||
# Objective: Calculate the area of a rectangle using floats.
|
||||
# Author: Edward Bigos
|
||||
# Date: 2025-0923
|
||||
|
||||
length = input("Enter a value for length: ")
|
||||
#print(type(length))
|
||||
length = float(length)
|
||||
# print(type(length))
|
||||
|
||||
width = float(input("Enter a value for width: "))
|
||||
|
||||
area = length * width
|
||||
|
||||
print("The area is",area)
|
13
bigos/lecture20250923/rectangleArea01.py
Normal file
13
bigos/lecture20250923/rectangleArea01.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
# Program: rectangleArea01
|
||||
# Objective: Calculate the area of a rectangle using integers.
|
||||
# Author: Edward Bigos
|
||||
# Date: 2025-0923
|
||||
|
||||
length = 4
|
||||
width = 3
|
||||
|
||||
area = length * width
|
||||
|
||||
print(area)
|
||||
print("The area is",area)
|
16
bigos/lecture20250923/rectangleArea02.py
Normal file
16
bigos/lecture20250923/rectangleArea02.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
# Program: rectangleArea02
|
||||
# Objective: Calculate the area of a rectangle using integers.
|
||||
# Author: Edward Bigos
|
||||
# Date: 2025-0923
|
||||
|
||||
length = input("Enter a value for length: ")
|
||||
#print(type(length))
|
||||
length = int(length)
|
||||
# print(type(length))
|
||||
|
||||
width = int(input("Enter a value for width: "))
|
||||
|
||||
area = length * width
|
||||
|
||||
print("The area is",area)
|
22
bigos/lecture20250923/rectanglePerimeter01.py
Normal file
22
bigos/lecture20250923/rectanglePerimeter01.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
# Program: rectanglePerimeter01
|
||||
# Objective: Calculate the perimeter of a rectangle using floats.
|
||||
# Author: Edward Bigos
|
||||
# Date: 2025-0923
|
||||
|
||||
print("\nCalculate the perimeter of a rectangle\n")
|
||||
|
||||
length = input("Enter a value for length: ")
|
||||
#print(type(length))
|
||||
length = float(length)
|
||||
# print(type(length))
|
||||
|
||||
width = float(input("Enter a value for width: "))
|
||||
|
||||
perimeter = 2 * (length + width)
|
||||
|
||||
print("\n")
|
||||
|
||||
print("The perimeter is",perimeter)
|
||||
print(f"The perimeter is {perimeter}")
|
||||
print(f"The perimeter of length {length} and width {width} is {perimeter}")
|
15
bigos/lecture20250923/sphereVolume01.py
Normal file
15
bigos/lecture20250923/sphereVolume01.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
import math
|
||||
|
||||
print("\nCalculate the volume of a sphere\n")
|
||||
|
||||
PI = math.pi
|
||||
radius = float(input("Enter a value for radius: "))
|
||||
|
||||
|
||||
volume = 4/3 * PI * radius * radius * radius
|
||||
|
||||
print(f"The volume is {volume}")
|
||||
print(f"The volume is {volume:.2f}")
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue