0
Как за 1 ввод задать несколько переменных? How to create several variables in one input?
For example we firstly input 4. And then we must enter 4 variables on one line in one line. Например, мы сначала вводим 4. И затем мы должны ввести 4 переменных в одной строчке
9 Respuestas
+ 1
You can take the input with spaces between them and then use the split method.
name, birthplace = input().split()
Depending on what it is, you might still transform a variable from str to what you need, for example int.
0
Can you describe and write this code please
0
I gave you the pattern.
Give it a try and apply it for what you need to do.
0
I just do not quite understand what you wanted to say.
0
For example I enter firstly 5 and then I enter only 5 variables in a second line no more
0
You can take the number of inputs first.
n=int(input())
And then you take one input, separated by spaces, and split it with the split method.
If you want to insist on n number of inputs, you can after that use an if block:
if n!=len(inputs):
print('You were supposed to input', n, 'numbers!')
0
думаю ввод -> переменная -> цикл будет достаточно просто )
0
You can do like this:
limit = int(input())
variables = [input() for _ in range(limit)]
This will fill a list with your inputs