F
F
Freezzd2018-02-04 12:39:49
Python
Freezzd, 2018-02-04 12:39:49

How to enter variables without knowing how many there are?

I recently started learning python. Now I decided to try myself in the Olympics. In one task it is written that the number of folders will be entered first, and then the number of files in these folders. And now the question arises, how to count the number of files, which will always change? If starting with If A = int(input()) (number of folders)
if A == 1:
M = int(input()) (number of files in one folder)
if A == 2:
M,N= map(int ,input().split()) (how many files in each folder separately)
would be too long (there could be 100 folders)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question