Tag Archives: WSQ10

WSQ10


WSQ10

WSQ10

WSQ10 – Lists

#WSQ10 #TC1017

 

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.(To this program, I needed help of my classmate Pablo Guerra)

 

 

 

 

 

 

 

 

Learn To Program 2015-04-06 19:47:00

WSQ10

Instrucciones:

  • Crear un programa que pregunte al usuario 10 numeros decimales.
  • Almacenarlos en una lista.
  • Mostrar al usuario la suma, el promedio y la desviación estandar de los mismos.
  • Extra: que el usuario diga hasta cuando decea detener el ingreso de los numeros.

Para ello, leí la siguiente información:
http://docs.python.org.ar/tutorial/3/datastructures.html
http://es.wikipedia.org/wiki/Desviaci%C3%B3n_t%C3%ADpica

**********************
Programa hecho en Python:
**********************
https://github.com/A01630323/Learn-To-Program/blob/master/WSQ10.py
https://github.com/A01630323/Learn-To-Program/blob/master/WSQ10_Extra.py

Learn To Program 2015-04-06 19:47:00

WSQ10

Instrucciones:

  • Crear un programa que pregunte al usuario 10 numeros decimales.
  • Almacenarlos en una lista.
  • Mostrar al usuario la suma, el promedio y la desviación estandar de los mismos.
  • Extra: que el usuario diga hasta cuando decea detener el ingreso de los numeros.

Para ello, leí la siguiente información:
http://docs.python.org.ar/tutorial/3/datastructures.html
http://es.wikipedia.org/wiki/Desviaci%C3%B3n_t%C3%ADpica

**********************
Programa hecho en Python:
**********************
https://github.com/A01630323/Learn-To-Program/blob/master/WSQ10.py
https://github.com/A01630323/Learn-To-Program/blob/master/WSQ10_Extra.py

Lists – WSQ10

#WSQ10

#WSQ10 Lists Check my code on Github https://github.com/Auralgo/-TC1017/blob/master/wsq10.cpp I had to review WSQ08 to remmember the use of functions, and look in wikipedia for

Lists Check my code on Github https://github.com/Auralgo/-TC1017/blob/master/wsq10.cpp
I had to review WSQ08 to remmember the use of functions, and look in wikipedia for what is standart deviation

Lists

Para realizar esta WSQ primeramente vi este video https://www.youtube.com/watch?v=Rl9xQ-B__1U para saber acerca de los arrays una vez estudiado pude hacer el programa.

Lists in Python 3

One of the most useful types in Python are the Lists. They consists in arrays of different types of information ordered, they can be manipulated and accesed in many ways. 

The source code of the program is in GitHub.

The program is about a list of 10 floating point numbers, called list1 , which will be typed in by the user. Once the user has typed the values then we will start some calculations that are defined in the functions in the Function Declaration section of the code. 

The first one takes the value of the total, originally 0.0, and then adds every single element of the list. Thus giving us the total of the numbers inside the list1. 

The second function is to calculate the average of the elements inside the list1. For this we simply use the total that we have already calculated, and divide it by the total of elements in the list1. For this we use the function len(), which applied to a list returns the number of elements contained in that list. 

The third function is the standard deviation of the list. This one is a little bit trickier. In order to calculate this another list is created, listd, which is the difference between each of the values inside list1 and the average that we have previously calculated. Once we have calculated this we need to calculate the square of the differences, and start adding them to a total variable. Once we have the total we can calculate the average of the square differences, so we divide it by the number of elements in the list.

After all those calculations we just use the math module to calculate the square root of the total.

The main topic of this post is to see how you can use a list with a for loop to read every value. Instead of using a range(), you can use a list so the for loop goes thru every single one of its values.

If the standard deviation calculation process wasn’t very clear,  here you can find a usefull page to understand it.

This is for my of my

LISTS

Here is my

I think it was too easy with arrays

LINK: https://github.com/JairBarragan/WSQs/blob/master/WSQ10