I'm using python 3.8, and I don't understand why my first if statement is being ignored. City is a class which has an attribute name. I first tried to just use an if statement with the city object itself, and then tried using the names and comparing that instead. When I run this every iteration leads to the first if statement being passed (even when it shouldn't), and the else never being executed.
for city in self.cities:
citylist.append(city.name)
for road in sortedroadlist:
city1 = road[0].name
city2 = road[1].name
if city1 or city2 in citylist:
finallist.append(road)
if city1 in citylist:
citylist.remove(city1)
if city2 in citylist:
citylist.remove(city2)
else:
sortedroadlist.remove(road)