When they said “in the program”, they probably meant “in a data structure”.
If there are going to be lots of numbers, you probably don’t want to have them in the code of your script.
Maybe you have them in a file numbers.txt, for example, with one number per line, or maybe there are empty lines.
You could do
maximum = float('-inf') # The smallest float. If you intend the numbers to be integers you will need to set a different default value here, or check the requirements for what would they want to return when the list of numbers is empty.
with open('numbers.txt', 'r') as infile: # Opening the file for reading
for line in infile:
maximum = max(maximum, float(line.strip())) # strip removes newline character, but maybe turning the line into a float still fails, for example, if the line is empty.
except ValueError: # This is the exception that will be raised when the content of the line cannot be turned into a number. We do nothing when that happens and keep on reading further lines from the file.
# Now `maximum` contains the maximum value.
One can only learn that which is outside, but sufficiently close to the horizon of what one currently understands. When the current knowledge is very limited (see those numbers written directly in a main.py file), then one learns best by imitation.
The comments inside the code are doing the “help the student learn”. More details could be added, if they ask.
Also homework is not the same as individual work. “Solving someone’s homework” is only a problem if the instructor who assigned the homework intended it as an evaluation of individual work. If that is the case, then not my problem. The instructor is the one at fault, for not knowing the role of homework in education.