Giter VIP home page Giter VIP logo

estat-stica's Introduction

Estat-stica

#!/usr/bin/envetor python

-- coding: UTF-8 --

def media(vetor): return sum(vetor) / len(vetor)

def moda(vetor): b, modas = 2, [] for i in vetor: a = vetor.count(i) if a > b: b, modas = a, [i] elif a == b and i not in modas: modas.append(i) modas.sort() return modas

def mediana(vetor): vetor.sort() if len(vetor) % 2 == 0: return media([vetor[int(len(vetor) / 2) - 1], vetor[int(len(vetor) / 2)]]) else: return vetor[int(len(vetor) / 2)]

def desvio_medio(vetor): return media([abs(i - media(vetor)) for i in vetor])

def variancia(vetor): return media([pow(i - media(vetor), 2) for i in vetor])

def desvio_padrao(vetor): return pow(variancia(vetor), .5)

if name == "main":

executa = True

while (executa):
    entrada = int(input("Insira a quantidade de valores da amostra: "))
    vetor = list(map(int,input("Insira os valores: ").strip().split()))[:entrada]


    if(len(vetor) >= entrada):
        executa = False


print("MEDIA: ")
print(media(vetor))
print(" ")

print("MODA: ")
print(moda(vetor))
print(" ")

print("MEDIANA: ")
print(mediana(vetor))
print(" ")

print("Medidas de Dispersão\n")

print("DESVIO MEDIO: ")
print(desvio_medio(vetor))
print(" ")

print("VARIANCIA: ")
print(variancia(vetor))
print(" ")

print("DESVIO PADRAO: ")
print(desvio_padrao(vetor))
print(" ")

estat-stica's People

Contributors

robertaab avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.