Beginner's problem

Hello, @Fonz, and welcome to the Python community!

We hope you enjoy learning Python.

Please see the following pages for information that will enhance your benefit from the discussions on this forum:

The first of those two pages offers important guidance regarding how to format Python code and program output for correct display whenever you post such content while asking and answering questions. Correct formatting is always essential.

As asked earlier in this discussion, please format your current code accordingly, so that it is easy for us to see important details such as its indentation.

With a guess at how your actual code is indented, it appears that regardless of what the user enters at the prompt, your code is always looking for the maximum and minimum values in the list assigned to the numbers variable. Instead, you should allow the user to enter the suggested 7, 2, bob, 10, 4, and done or any other data at the prompts that appear during program execution. Most likely, that data suggested in the instructions is just an example meant to clarify what your program should do, and as a means to test it. Your program needs to be rewritten to execute correctly for that data, or any other set of data that is entered.

Your code includes handling of a situation wherein an entered value cannot be converted to an integer. Handling possible errors such as that is a good policy. However, something else that your code does not anticipate is a situation wherein the user simply enters done during the very first iteration of the loop. In that case, there would be no numerical data to process, and therefore no maximum and minimum value to determine. Later on, after you have gotten your code to work according to the instructions that were given, you could add the ability for it to handle such a situation.

1 Like