Python Notes

The sum of the digits of a random three-digit number

The program generates a random three-digit number and calculates the sum of its digits.

In this case, the problem can be solved using a linear algorithm, since the amount of digits of a number is known and this amount is small. However, similar tasks, especially when the amount of digits are unknown, are solved using cycles.

Example of program execution:

306
9