Q. Write a program to accept the age of an employees and count the number of person in the following age group.

(a) 26-35

(b) 36-45

(c) 46-55


You can understand by Watching video :-



Answer :-

a = 0
b = 0
c = 0
while True :
    emp = int(input("Enter the age of employees (enter 0 (zero) for quit )= "))
    if emp == 0 :
        break
    else :
        if 25 < emp and emp  < 36 :
            a = a + 1
        if 35 < emp and emp < 46 :
            b = b + 1
        if 45 < emp and emp  < 56 :
            c = c + 1
print("the age of employees 26 - 35 = ", a)
print("the age of employees 36 - 45 = ", b)
print("the age of employees 46 - 55 = ", c)

Output :-

Enter the age of employees (enter 0 (zero) for quit )= 26
Enter the age of employees (enter 0 (zero) for quit )= 45
Enter the age of employees (enter 0 (zero) for quit )= 52
Enter the age of employees (enter 0 (zero) for quit )= 51
Enter the age of employees (enter 0 (zero) for quit )= 46
Enter the age of employees (enter 0 (zero) for quit )= 38
Enter the age of employees (enter 0 (zero) for quit )= 29
Enter the age of employees (enter 0 (zero) for quit )= 46
Enter the age of employees (enter 0 (zero) for quit )= 32
Enter the age of employees (enter 0 (zero) for quit )= 29
Enter the age of employees (enter 0 (zero) for quit )= 0
the age of employees 26 - 35 =  4
the age of employees 36 - 45 =  2
the age of employees 46 - 55 =  4

>>>

2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post