I am new here. I passionately need the help of python gurus here to help solve this my statistics analytics problem.
I want to write a python code that prompts for an imput. Then saves the new input data into a table of numbers at the last position while it deletes the number on the first of the table.Then it search for specified decimal numbers from the table of numbers and gives an output based on a particular condition.
Here is an example of the table.
7.48, 1.11, 1.16, 2.00, 1.49, 3.43, 4.20, 1.04, 20.56, 3.53, 5.61, 2.01, 1.58, 3.91, 3.63, 1.40, 2.03, 1.50, 1.05, 1.01,
According to the table, the first data is 1.01 while the last or most recent data is 7.48.So whenever the code prompts for an inputs, it saves the new input at the top left ( where 7.48 is) and deletes the number at the bottom right ( where 1.01 is) of the table.
So if i input 1.60 as a data, the code executes and the table now becomes like this
1.60, 7.48, 1.11, 1.16, 2.00, 1.49, 3.43, 4.20, 1.04, 20.56, 3.53, 5.61, 2.01, 1.58, 3.91, 3.63, 1.40, 2.03, 1.50, 1.05
Now for the second task the code does. It searches the table for a set of Predetermined decimal numbers. They are basically four but they have variations. For this code, each decimal and its variants are the same. The decimal numbers are 1.3, 1.4, 1.5 and 1.6.
The variants are infinite but must contain the integers that make up the decimal. For example 60.01, 63.1, 12.56, and 180.66 are all variants of 1.6 and will be recognized by the code as 1.6. But 16.0 is not a variant of 1.6 because the integar 6 and 1 aren't separated by a decimal point
Similarly numbers 40.1, 54.81, and 51.49 are all variants of the decimal number 1.4 but 6.14 is not a variant of 1.4 as the integer 1 and 4 aren't separated by a decimal point.
So the code searches for the last three incidence of the decimals/their variants and then checks if there is a number equal or greater than 2 at an equal distance before the decimal number in the last 3 incidences of the decimal. I will explain this better using the table.
If execute the code on the first table above, i expect to get this as one of the outputs for Decimal 1.4 " Decimal 1.4 is checked at distance 1"
Reading the table from the top left to right, the last 3 incident of decimal 1.4 are:
1.49(first row, column five)
1.04(second row column three)
1.40(fourth row, column one)
From left to right, the number that precedes all three decimals (2.00,4.20 and 3.63) is equal or greater than 2 and they are all at the same distance from each of the decimals (1.49, 1.04, 1.40). This distance is counted as 1 because they(2.00,4.20,3.63) are all one step before the Predetermined decimal.( reading data from left to right and up to down).
The code proceeds to check all three incidences of the decimal again at count 2, if there is a number equal or greater than 2 preceding all of them, it will output a result like this " Decimal 1.4 is checked at distance 2". If there is no number equal to or greater than 2 at the same distance for all 3 incidences, it outputs the previous checked result ( if there was a previous result) or it simply says, decimal 1.4 not checked.
Using another example, Reading from top left to right from the first table, the last three incidences of decimal 1.5/variants are at:
I.58(third row column three)
5.61 (third row, column one)
1.05 (fourth row, column four)
There is another decimal 1.5/variant at row four column four but we are only dealing with the last 3 incidence of the decimals we are analyzing. So because we read from top left to right, 1.05 row four isnt part of what we need, so the code leaves it out.
It will give this output as one of its result " Decimal 1.5 is checked at distance 4"
Thats because if we count from from right to left for the 3 most recent decimal 1.5 (1.58, 5.61 and 1.05), exactly at count 4 places, there is a number equal or greater than 2 at the same distance for all numbers.
Hence it satisfies the condition.
Please help me out.if there is a further explanation needed, i will be glad to provide.
Edit* The table was originally in columns and rows but after posting it here it became just two lines of numbers. It still works. The rows and and columns are just for explanation