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,8 @@
data1 = float(input("Enter the dividend "))
data2 = float(input("Enter the divisor "))
quotient = data1/data2
print(f"{data1}/{data2} = {quotient}")

View file

@ -0,0 +1,13 @@
import sys
data1 = float(input("Enter the dividend "))
data2 = float(input("Enter the divisor "))
try:
quotient = data1/data2
print(f"{data1}/{data2} = {quotient}")
except:
print(f"Invalid value. Division by zero is not allowed.")
sys.exit(-1)

View file

@ -0,0 +1,20 @@
import sys
try:
data1 = float(input("Enter the dividend "))
except:
print(f"Invalid value for the dividend ")
sys.exit(-2)
try:
data2 = float(input("Enter the divisor "))
except:
print(f"Invalid value for the divisor ")
sys.exit(-3)
try:
quotient = data1/data2
print(f"{data1}/{data2} = {quotient}")
except:
print(f"Invalid value. Division by zero is not allowed.")
sys.exit(-1)

View file

@ -0,0 +1,19 @@
import sys
def getFloatValue(message):
try:
data1 = float(input(message))
except:
print(f"Invalid value for a floating point number. ")
sys.exit(-2)
return data1
data1 = getFloatValue("Enter value for the dividend ")
data2 = getFloatValue("Enter value for the divisor ")
try:
quotient = data1/data2
print(f"{data1}/{data2} = {quotient}")
except:
print(f"Invalid value. Division by zero is not allowed.")
sys.exit(-1)