How to take 3 or more inputs separated by a newline in Python? | Sololearn: Learn to code for FREE!
+ 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 ‚ėļÔłŹ

15th Sep 2020, 5:52 PM
Sabokhat Kalandarova
Sabokhat Kalandarova - avatar
2 Respostas
+ 4
Multiple inputs separated by line: name = input() age = input() print(name + " is " + age)
15th Sep 2020, 5:58 PM
JaScript
JaScript - avatar
+ 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)
15th Sep 2020, 8:13 PM
Per Bratthammar
Per Bratthammar - avatar