Lecture 11/17/2026
This commit is contained in:
parent
07b9e54bf0
commit
bf3265103a
44 changed files with 1195 additions and 3 deletions
20
lecture20261117/try/try03.py
Normal file
20
lecture20261117/try/try03.py
Normal 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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue