# WSQ07 – Lists (total, average and standard deviation)

--Originally published at TC1017 (Python3) – Titel der Website

Hello Guys,

after a long time its me again! Sercan aka. Sergio

I had a big problem with the standard deviation while i was doing this WSQ. Actually i didn´t even found something in the internet how to program this that. Well, to solve the problem i needed help from the Superheroprogrammerwithstil Ken. So I made an appointment with him to talk about this issue.

The result of the source code is, that i implement with Ken a lot of new Python code, which i didn’t knew before.

Python has his own Math library. That means, if you don´t call the library or a specific function of the library, python is not able to do things which you want to do. In line 1 e.g. i call the specific math function sqrt. But to make sure that all math functions are reachable, i just call them with import math.

To make sure that don´t program unnecessary code for the input of 10 numbers I just programmed a for loop until the User gives the program 10 Numbers.

To unterstand the lines from 16 – 25 we need to know how the standard deviation works.

Therefore the formula.

So we need the total for the average and the average for the fraction of the st. dev.

After we have that all, we just use the math function to make sure that we extract the root.

The result is:

Enjoy Fellas.

# WSQ07

--Originally published at Ernesto&#039;s Computing Works

Para el #wsq07 debía crear un programa que le pidiera al usuario 10 números de valor float (osea que tuvieran capacidad de tener decimales). Después, almaceno esos 10 números en una lista, y y al final tiene que desplegar al usuario el total, el promedio y la desviación estándar de esos 10 números. Esas son operaciones matemáticas usadas comúnmente en finanzas y estadísticas.

Ademas, debía cambiar el programa para un tamaño indefinido de números que el usuario me diera, y parara de recibir valores cuando el dijera que fue suficiente, solo que a mi se me paso ese detalle y no lo agregue al programa por lo que nomas funciona con 10 números, pero lo único que tenia que hacer es usar un condicional y una variable string para que cuando el usuario pusiera “no more values” terminara el programa.

Este es mi programa

Para este programa use una nueva función de c++ que son los vectores y arreglos, al principio no sabia que era ni como usarlo pero investigue al respecto y supe como hacerlo, pero batalle mucho y tarde dos días en lograrlo, también fue la primera vez que use un loop con for, para lograrlo este programa investigues en estas fuentes:

-https://www.programarya.com/Cursos/C++/Estructuras-De-Datos/Arreglos-O-Vectores

-http://ejemplos.mis-algoritmos.com/calcula-la-suma-de-los-elementos-del-arreglo_2

-https://www.youtube.com/watch?v=5gLOxfYWDjQ

Como había dicho anteriormente aquí use por primera vez el un loop con “for”, que demuestra como usar el mastery topic #14, de hecho para vectores siempre se usa este loop, que indica que el programa va a hacer algo desde cada valor del vector de 0 a el valor que tu indiques y cuando llegue a ese valor acaba el loop.

También se abarca otro mastery topic muy importante que es el numero #18, en el que demuestro como usar un vector en lenguaje c++, indispensable para este programa.

# WSQ07 – List

--Originally published at Solving problems with programming

In this WSQ i have to look, learn and search everything about vectors ands arrays. and i think it is an important topic because it makes your code easier and programming with this new kind of knowlegde gives you more alternatives.

I´ve to say that not everything was easy, there was days where i can´t find anything that improve my skills with arrays, but with more days i learned enough of vector and arrays.

Haga click para ver el pase de diapositivas.

# WSQ07 – Lists

--Originally published at BRENDA

Here is my full code for this assignment:

https://github.com/brendaruizt/TC1017/blob/master/lists.cpp

For this task, I had to investigate and learn about arrays. This is where I obtained information:  Arrays. Also, from the book I have already mentioned in previous posts.

Basically an array is a list where information is stored. A size of the array must be defined. This is how I did the array:

int i;
float numbers [10];
float sum = 0.00;
for(i = 0; i < 10 ; i++) {
cout << “Please enter 10 numbers (float): “;
cin >> numbers [i]; }

Here I define the size of the array as 10 because of the excercise. In this example, the user is the one that defines the numbers that are going to be stored in the array.

I did a function that calculated the average and another that calculated the standard deviation.

# Lists – WSQ07

--Originally published at Programming in C++

For this program we had to ask the user for 10 numbers and saved the in a list. In this case I used arrays, but it can also be done with vectors. And then show to the user the total, average and standard deviation of those numbers.

Here are the 3 functions of the program (one for total, one for average, and one for standard deviation). The only new thing is putting arrays on them. Which is actually simple. You put the name of the array and then the size of it .

#### Now we have the main part:

Here we have our array and its size. The size of the array is put between “[ ]”. Then there is a for for inserting the values. When talking about arrays we have to remember that it does not start counting in 1, it starts with 0, so that’s why our i starts there.

# WSQ 07

--Originally published at Blog TC1017

I had a lot of trouble with this one, first, I did not even know I had to add a new library to use certain commands, that’s why I could not compile it. I asked a friend for help and he told me to include math.h for me to be able to use “sqrt” which is a command to execute the square root.

Haga click para ver el pase de diapositivas.

# List of numbers

--Originally published at Future Queen of C++

This was a challenging WSQ, because at first I tried to do it with an array that did not had an specified size, but I failed because it was really confusing for me. I spend two whole weeks trying and looking in google everything. At the end, I realized that it was easier to beging with a level one and do the basic WSQ, so here is the result with vectors :

For this WSQ I mainly used blogs of some classmates and the book:

# WSQ07 with Vectors

--Originally published at Valeria CT

In order to let user input values without declaring how many at the beginning, we can use vectors. However, I wasn’t able to perform any function by calling the values in a vector, so I also created an array with values from the vector and the it was easy to perform the function that I had writen previously on my other WSQ07s.

The link to my program is: https://github.com/valeriact/tc1017/blob/master/wsq07-4.cpp

The resources I used are:

-Valeria