Hi guys, i am new here. Been on this code for some days and i seem stuck and not getting the expected output from this code.
first the code functions as a FIFO QUEUE where it takes input from the user and put it at the beginning of a list while deleting the last item on the list and creating a new list.
then i did function to search for four floating numbers (1.3,1.4,1.5,1.6) in the new list such that any float in the list that has identical integer part and decimal part split like any of the four floating numbers(1.4, 1.5, 1.6, 1.3) is denoted as a variant of the float e.g 17.34, 35.19 and 30.01 will be variants of float 1.3. Similarly 12.56, 57.17 and 10.50 will be variant of float 1.5. Also,a float like 14.31 if present in the list will be regarded as a variant of both 1.3 and 1.4 while float 15.61 will be regarded as a variant of both float 1.5 and 1.6.
So anytime the code runs, it takes the first THREE numbers each in the list or queue that are variants of 1.3,1.4,1.5 and 1.6 and create a new list for each variant. for example
list1 =[1.72, 10.60, 34.21,18.40, 11.13, 45.33, 1.03, 35.91]
this list has 4 variants of float 1.3
the new lists that will be created for float 1.3 from this list when i run the search function is:
new list a=[1.72, 10.60,34.21]
new list b=[1.72, 10.60, 34.21, 18.40,11.13]
new list c=[1.72, 10.60,34.21, 18.40, 11.13,45.33,1.03]
Lastly, the code performs a reverse indexing on each of the 3 new list with the second to the last number on each list having an index of 1 and third to the last digit having an index of 2. if there is any number in each of the new list that is equal to or greater than 2 with the same index index number, then there is a match. and the functions returns an output. the number only has to be equal to or greater than 2 but the index must match for all 3 new list.
from the above lists, the code returns an output like this" there is a match at index 1 for variant 1.3"
attached to this post is the code i have written. its a bit longer than it should if not i would have posted it on here. it runs without any problems for the first run, but subsequently fails to bring out expected output when i change the number in the list or when the queue FIFO starts working.
i will be happy if anyone can take a look and help check whats wrong with it or help modify it to work as i want