Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python exceptions

while True:
    try:
        funds = float(input("Enter amount to transfer: "))
        if funds < 0:
            raise Exception("Please enter a positive value,")
        break
    except ValueError:
        print("Please enter a numeric value,")
Source by www.futurelearn.com #
 
PREVIOUS NEXT
Tagged: #python #exceptions
ADD COMMENT
Topic
Name
1+5 =