Is it worth doing exercises that teach not very optimized ways to make a program? [closed]

0

Well, I'm learning python and sometimes I come across some relatively difficult exercises, for example, an exercise where the program had to read a cash value and say how many 1, 5, 10, 20, 50 , 100 that money could be represented.

The problem is that only conditional structures and mathematical operators could be used.

Doubt

Is it worth doing this type of exercise and learning how to make a code that could be simplified?

What is the purpose of this type of exercise?

    
asked by anonymous 23.02.2018 / 02:46

1 answer

1

In fact, if you already understand what the code looks like, and you can imagine it in your mind, you do not have to do it. In particular, if you can not use loop structures, I recommend not to do - too artificial, and too useless (you will not have how to solve it generically, for any value). Instead, take more challenging exercises

The goal is to make sure that anyone learning to program for the first time understands conditionalities - if you have already understood, you do not have to follow these restrictions: any real problems you take will exert the use of conditionals as well.

One place that has some cool issues is the project Euler - all problems are numeric in nature, and the answer is a single number, but almost everyone demands that you create a program to get the answer - and it does not matter to them how you did the program or in what language, just the answer number. The exercises are gradually becoming more difficult, and it soon becomes natural that either you make the algorithm more efficient, or your program would be running for a couple of years.

    
23.02.2018 / 13:50