Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to take multiple inputs in one line in python using list comprehension

# taking two input at a time
x, y = [int(x) for x in input("Enter two values: ").split()]
print("x: ", x)
print("y: ", y)

# taking three input at a time
x, y, z = [int(x) for x in input("Enter three values: ").split()]
print("x: ", x)
print("y: ", y)
print("z: ", z)
Source by www.codewithberi.xyz #
 
PREVIOUS NEXT
Tagged: #How #multiple #inputs #line #python #list #comprehension
ADD COMMENT
Topic
Name
8+8 =