How would I make a python program to make a library of input values and compare values to the 3rd and 7th deciles of the input values?
@e.mccormick
so where are you stuck?
I don't know python very well. I can make the data into a list, but I can't figure out a way to organize it so I can find the 3rd and 7th deciles
You need to sort the list by whatever criterion is needed. Then use the length of the list to determine the dectile length. Then make a double loop or pair of loops to process the groups with the other and items with the inner. The values in the inner loops start at whatever spot is the start of the desired tenth, and have as many elements as the 10th has.
Because the lengths may vary by rounding differences, the length is unique to the 10th selected. Here is one way that could be done. I think it needs a little work to make it cleaner, but you should get the general idea. ``` data = some list desired_dectiles = {start_spot_1:length_1, start_spot_2:length_2} for dectile in desired_dectiles.keys(): for item in range(dectile, dectile+1+desired_dectiles[dectile]): do some work and so on ```
Ah, and there is the list[a:b] stuff too. What you use depends on how you want to deal with it. This is called slice notation. http://stackoverflow.com/questions/509211/the-python-slice-notation
Join our real-time social learning platform and learn together with your friends!