+ 2
How to take 3 or more inputs separated by a newline in Python?
A= input() function is only for 1 input, I don't know how to take multiple value as variables: a, b, c and etc. Every useful comment is highly appreciated ☺️
2 odpowiedzi
+ 4
Multiple inputs separated by line:
name = input()
age = input()
print(name + " is " + age)
+ 1
# Decide the numbers of inputs.
n = 5
# Put the inputed values in a list.
lst = []
for i in range(n):
lst.append(input(f"Input{i+1} = "))
print(lst[-1]) # For Sololearns app.
print(f"\n{lst}")
# Assign the values to variable names.
a, b, c, d, e = lst
print(a, b, c, d, e)