input for competitive programming 1

input for competitive programming

with open('lifeguards.in','r') as fin:
  n = int(fin.readline().strip())
  n,l = map(int,fin.readline().strip().split())

Here is what the above code is Doing:
1. It’s reading the first line of the input file, which is the number of lifeguards.
2. It’s reading the second line of the input file, which is the number of cows and the length of the pasture.
3. It’s splitting the second line into two numbers, the number of cows and the length of the pasture.
4. It’s mapping the two numbers to the variables n and l.

Similar Posts