Q:

how to take input according to the user in python

var = input("Text: ")
7
# creating an empty list 
lst = [] 
  
# number of elemetns as input 
n = int(input("Enter number of elements : ")) 
  
# iterating till the range 
for i in range(0, n): 
    ele = int(input()) 
  
    lst.append(ele) # adding the element 
      
print(lst) 
3
a = input("what is your input")
1
# if you want to ask the user to input anything, use the keyword "input"

# example

a = input("What is your name") # the user will be prompted to answer the question 

print(a) # this allows the user to actaully see the question or anything
3
x = input("enter prompt here: ")
0

New to Communities?

Join the community