Question about exercise

i am a beginner on python learning curve…
referring to the above program ‘’, why ‘classes’ weren’t used instead so many functions…

many thanks…

It would help those of us who do not know what course or exercise you are referring to if you would be more specific about the exercise.

You mention that you are a Python beginner. Unlike some other languages, such as Java, in Python, classes are not usually introduced until later in the curriculum.

DNA Analysis

There are only four functions, each with a single purpose. What would be the need to instantiate class objects? They would only take up memory. We have a sample and three suspects. Once we’re done, we’re done. There is no long standing sesssion that might make better use of a class.

Or is you question more relating to why is Python not more like C or Java?

when to specify classes instead functions?

If all we want is an answer, then a class is not needed. Write a couple functions and run them on the data.

When there is an indefinite amount of data that can be grouped, or classified, then class helps to give all the instances the same set of methods and attributes. A class is more session oriented with new object instances cropping up all the time. Class instances retain their own unique data that methods of the class can be used to update.

This project does have a need to retain instances and the session ends the second we’re done running the program on a suspect file.