Friday, November 19, 2021

Python IF ELSE WHILE BREAK

Breaks out of the loop

 while True:
    print('***** BEGIN ******')
    print('Program to find if the person is a Minor, Teenager or Adult.')
    print('Enter a value :')
    age=int(input())
    
    if(age>0 and age<13):
        print('Participant is a Child')
    elif(age>13 and age <18):
        print('Participant is a Teenager')
    elif(age>18):
        print('Participant is an Adult')
    elif(age==0):
        break;

print('*** EXIT END OF PROGRAM *****')

No comments:

Post a Comment

Please add value. Sharing is caring