I want to remove every element from the list that has "KA" sub string but when i tried to do so, it was not working properly.
def removeKA(reg_list):
for reg_no in reg_list:
if "KA" in reg_no:
reg_list.remove(reg_no)
print(reg_no)
reg_list = ["KA09 3056","KA12 9098","MH10 6776","GJ01 7854","KL07 4332"]
removeKA(reg_list)
No error messages were encountered. But Output should be KA09 3056 KA12 9098
But instead of that i am getting output as KA09 3056