<aside>

<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />

Navigation

</aside>

</aside>

<aside>

Taking User’s Input


# the input() function is used to take input from the user

name = input("Enter your name: ")
age = input("Enter your age: ")

print("your name is:", name)
print("your age is:", age)

Take Multiple Input in Python


We are taking multiple input from the user in a single line, splitting the values entered by the user into separate variables for each value using the split() method. Then, it prints the values with corresponding labels, either two or three, based on the number of inputs provided by the user.

x, y = input("Enter two values: ").split()
print("Number of boys: ", x)
print("Number of girls: ", y)
 
x, y, z = input("Enter three values: ").split()
print("Total number of students: ", x)
print("Number of boys is : ", y)
print("Number of girls is : ", z)

<aside>

output:

Enter two values: 5 10

Number of boys: 5

Number of girls: 10

Enter three values: 5 10 15

Total number of students: 5

Number of boys is : 10

Number of girls is : 15

</aside>