Programming Examples
Write a program that checks if a number is positive using the assert statement.
Write a program that checks if a number is positive using the assert statement.
Solutionnum = int(input("Enter a number: "))
assert num > 0, "The number is not positive!"
print("The number is positive.")
▶ RUN Output/ Explanation: