After a brain-burning-process, I finally got it. After some appointments to Ken’s office and tons of coffee, Yo soy 196 is here.
First of all, we shall create functions that will help us to find which number is a palindrome, which one can become one and which one is a Lycherel number.
The second part is a BIG piece of code. Here it is:
From line 13 to line 21 I created three lists to add the values depending on it’s category. And of course, I wrote the inputs to get our upper and lower bound to evaluate the range between them.
And trust me, there´s no better way to explain the following lines than with a flowchart, a magical flowchart:
Last lines are written to print the results.
Hey there! We’ll be developing the WSQ10 assignment in this blogpost.
This code is not difficult but is longer than the rest. Here’s the description:
“Create a program that asks the user for 10 numbers (floating point). Store those numbers in a list. Show to the user the total, average and standard deviation of those numbers.”
Before we get started, let’s define the average and the standard deviation.
- Standard deviation: Is a measure that is used to quantify the amount of variation or dispersion of a set of data values. (Source: https://en.wikipedia.org/wiki/Standard_deviation)
- Average: Is the sume of all the elements of a list divided by the number of elements.
Now, let’s start.
We’ll build this code in three parts. The yellow one is about functions, the green one is the part that will ask the user for the 10 numbers and append them in a list, and the red one will print the results, calling the functions.
The first function is really easy, we just sum the elements form the list in line 20. The second function is the most difficult one. The formula to get the standard deviation, we need to compare each value with the total average, then square that sum, and at the end, divide everything by the number of elements on the list, in this case, 10.
The last function will be the average, we just sum all the elements divided by 10.
Line 27, 28 & 29 are going to call our three functions and print the results.
Here are the results. The program asks the user correctly for 10 numbers and then the list gets printed. after that, as we were waiting, we get the total, the average and the standard deviation.
Here’s my code. If you have a suggestion about how to improve my code, pleas comment bellow.
Have a nice day!!!