Lecture 11/17/2026

This commit is contained in:
Edward Bigos 2026-11-17 12:30:27 -05:00
commit bf3265103a
44 changed files with 1195 additions and 3 deletions

View file

@ -0,0 +1,30 @@
print("Calculate the area of a rectangle")
counter = 3
length = float(input("Enter the length of one side: "))
while(length <= 0):
print("ERROR: The length must be greater than zero")
print("You entered {}".format(length))
counter = counter - 1
if(counter <= 0):
print("Too many tries. Program exiting.")
exit(-1)
length = float(input("Enter the length of one side: "))
runFlag = True
counter = 3
while(runFlag):
width = float(input("Enter the width of the other side: "))
if(width <= 0):
print("ERROR: The width must be greater than zero")
print("You entered {}".format(width))
counter = counter - 1
if(counter <= 0):
print("Too many tries. Program exiting.")
exit(-1)
else:
runFlag = False
area = length * width
print("The area is {}".format(area))