Skip to content

Lab functions complete - Maya - #11

Open
Maya-Souza wants to merge 2 commits into
Ironhack-data-bcn-oct-2022:mainfrom
Maya-Souza:main
Open

Lab functions complete - Maya#11
Maya-Souza wants to merge 2 commits into
Ironhack-data-bcn-oct-2022:mainfrom
Maya-Souza:main

Conversation

@Maya-Souza

Copy link
Copy Markdown

No description provided.

@samuelTAIronhack samuelTAIronhack left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, for question 9 I have posted a possible solution below.
For question 11 remember the explenation that was given this morning by your classmate. Check slack for a reminder 9he posted it in a thread in the general chat.

from statistics import stdev
def st_dev(arr):
    
    total_elements = 0
    total_sum_elements = 0
    
    for num in arr:
        total_elements +=1
        total_sum_elements += num
    
    mean = total_sum_elements/total_elements
    
    deviation = 0
    
    for num in arr:
        deviation += (num-mean)**2
    
    standard_deviation = (deviation/(total_elements-1))**0.5
    
    return standard_deviation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants