0% completed
try:
print("Try block")
raise ValueError("Raising ValueError")
except ValueError:
print("Handled ValueError")
finally:
print("Finally block")
x = -5
if x < 0:
raise ValueError("Negative value not allowed")
try:
x = int(input("Enter a positive number: "))
if x <= 0:
raise ValueError("That is not a positive number!")
except ValueError as ve:
print(ve)
assert (1 == 2), "One is not equal to two."
.....
.....
.....