0

How to stop program after wrong input in if else conditions

I wrote a program in python language actually i am biggner now I want to stop my program after insert wrong conditions in if/else/elif conditions Pls help me

24th Aug 2020, 10:02 AM
Meet Odishow
Meet Odishow - avatar
3 Réponses
+ 1
#Use sys.exit(). import sys five = int(input("Enter the number 5: ")) if five==5: print("\nInput accepted.") else: sys.exit("\nInvalid. Abnormal exit.") print("Program exited normally.")
24th Aug 2020, 12:35 PM
Brian
Brian - avatar