Find the median and the quarts parts of a statistic sequence in #pythonprogramming: a thread
1/ First write an median function which find the half indice of a list using n = len(list) (lenght of list) means (n-1)/2 if n is odd and between n/2 - 1 and n/2 if n is even.
In this function, we particularly use % for design arithmetic rest and int operator to convert float to integer. NB: we suppose that at the beginning, list is range by increase order.
2/ Afterwards we define a new function using same logic, but in more take an list of notes,
create a new list knowing that value of first list list[i] design students number who have been the note i. And send the median of the new list.
NB: we use concatenate in the mediane_notes at the line b = b + (effectif_notes[i]*[i]) to add [i] effectif_notes[i] times to list b.
3/ And the last function calcule_quartiles(liste) which give (using precedent median function ) to give the series quarts: Q1 (median of the first list half), Q3(median of the second list half), abd Q2 (median of all the list).
NB: we use list[0:j] which design all the elements
of list between indices 0 and j-1, and list[k:] which design all the elements between fro k indice until end of list.
#Math #statistics #100DaysOfCode #CodeNewbies
#pythonlearning

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Franzo Sotch

Franzo Sotch Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(