Accept Total Number of Participants in Class Program in Python

Accept total number of participants in class program in python. Using this program we can find the number of participants in each batch with help of python program for beginners

If Else Statement in Python

An if else clause The true or false value of an expression is determined by a Python statement. You can create a chain of if statements using the if/else if statement. The if statements are evaluated one after the other until one of the if expressions is true or the if/else if chain ends. If there is no true expression at the end of the if/else if chain, no code blocks are executed.

Operator in Python Program

Operators are special symbols in Python that conduct arithmetic and logical calculations. The value on which the operator acts is known as the operand. In Python, there are three basic types of logical operators: logical AND, logical OR, and logical NOT. Keywords or special characters are used to represent operators.

Print() Statement in Python

The print() function sends a message to the screen or another standard output device. The message can be a string or another object, which will be converted to a string before being displayed on the screen. The print statement sends data to the display terminal or another print unit that has been defined. The output device to which data will be written by the print statement is determined by the print statement. With this method we can execute the program like accept total number of participants in class program in python.

p = int(input('Enter the Number of Participants'))
if (p<100 or p>200):
   print('Wrong Input')
else:
        a = int(p/4)
if(p%2==0):
        print('Participants in batch A',a)
        print('Participants in batch B',a)
        print('Participants in batch C',a)
        print('Participants in batch D',a)
else:
        b = p%4
        print('Participants in batch A',a)
        print('Participants in batch B',a)
        print('Participants in batch C',a)
        print('Participants in batch D',a+b)

Output:

Enter the Number of Participants170
Participants in batch A 42
Participants in batch B 42
Participants in batch C 42
Participants in batch D 42