Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

PREVIOUS NEXT
Code Example
Python :: scrape pdf out of link 
Python :: keras sequential layer without input shape 
Python :: ros teleop 
Python :: django http response 204 
Python :: minio python make an object 
Python :: set difference in multidimensional array numpy 
Python :: find in python 
Python :: iterate over rows in numpy matrix python 
Python :: python remove specific character from string 
Python :: split string with first numerical value in python 
Python :: input a number and print even numbers up to that number in python 
Python :: django get form id from request 
Python :: a softmax function 
Python :: any() and all() 
Python :: python download chromebook 
Python :: plotly create plot 
Python :: supress jupyter notebook output 
Python :: float error python 
Python :: change folder name python 
Python :: access cmd with python 
Python :: ocaml returns the last element of a list 
Python :: how to create a function in python 
Python :: change creation date filesystem py 
Python :: Example pandas.read_hfd5() 
Python :: int to float python 
Python :: tkinter auto resize height 
Python :: Dictionary Cache 
Python :: select column in pandas dataframe 
Python :: numpy unique axis 
Python :: Python remove duplicate lines from a text file 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =