0
import numpy as np

def removeIncomplete(id):
    idComplete = np.array([])
    list1 = (1.1,1.2,1.3)
    list2 = (2.1,2.2,2.3)
    list3 = (3.1,3.2,3.3)
    list4 = (4.1,4.2,4.3)
    list5 = (5.1,5.2,5.3)
    if 1.1 and 1.2 and 1.3 in id:
        idComplete = np.append(idComplete,list1)
    if 2.1 and 2.2 and 2.3 in id:
        idComplete = np.append(idComplete,list2)
    if 3.1 and 3.2 and 3.3 in id:
        idComplete = np.append(idComplete,list3)
    if 4.1 and 4.2 and 4.3 in id:
        idComplete = np.append(idComplete,list4)
    if 5.1 and 5.2 and 5.3 in id:
        idComplete = np.append(idComplete,list5)
        return idComplete

print(removeIncomplete(np.array([1.3, 2.2, 2.3, 4.2, 5.1, 3.2, 5.3, 3.3, 2.1, 1.1, 5.2, 3.1])))

result: [1.1 1.2 1.3 2.1 2.2 2.3 3.1 3.2 3.3 5.1 5.2 5.3]

this is my code, in my code i am checking, that if these conditions meet the list, then print the numbers. in the assignment i have to print the numbers only if all 3 "1.1 , 1.2 , 1.3" are there, if not then it shouldn't print it

what confuses me with my code, is that in the added array at the print statement, there is 1.3 and 1.1 but no 1.2, why does it at the end print 1.1 1.2 and 1.3 when clearly there is no 1.2, it should have instead looked like this:[2.1 2.2 2.3 3.1 3.2 3.3 5.1 5.2 5.3]

the funny thing is, it correctly dosen't print 4.1,4.2,4.3 please help!

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
sedative
  • 1
  • 2

0 Answers0