kalakand
0
Q:

how to take an input in python

# Taking string input
a = input("Enter a string: ")
print("String is: ", a)

# Taking integer input
b = int(input("Enter an integer: "))
print("Integer is: ", b)

# Taking float input
c = float(input("Enter a float value: "))
print("Float value is: ", c)
2
#basic user handling for begginers

x = input("your question here") # when someone types something here that answer will be saved and be used for later

# for example 
print(x)
8
name = input("What is your name? ") 
print("Hi, " + name)
1
# Python program showing 
# how to take multiple input 
# using List comprehension 
  
# taking two input at a time 
x, y = [int(x) for x in input("Enter two value: ").split()] 
print("First Number is: ", x) 
print("Second Number is: ", y) 
print() 
  
# taking three input at a time 
x, y, z = [int(x) for x in input("Enter three value: ").split()] 
print("First Number is: ", x) 
print("Second Number is: ", y) 
print("Third Number is: ", z) 
print() 
  
# taking two inputs at a time 
x, y = [int(x) for x in input("Enter two value: ").split()] 
print("First number is {} and second number is {}".format(x, y)) 
print() 
  
# taking multiple inputs at a time  
x = [int(x) for x in input("Enter multiple value: ").split()] 
print("Number of list is: ", x)  
5
an_input = input("Input something please")
0
# Python program showing  
# a use of input() 
  
val = input("Enter your value: ") 
print(val) 
2

New to Communities?

Join the community