MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __len__

Method __len__

other/davis_putnam_logemann_loveland.py:50–59  ·  view source on GitHub ↗

To print a clause as in Conjunctive Normal Form. >>> len(Clause([])) 0 >>> len(Clause(["A1", "A2'", "A3"])) 3

(self)

Source from the content-addressed store, hash-verified

48 return "{" + " , ".join(self.literals) + "}"
49
50 def __len__(self) -> int:
51 """
52 To print a clause as in Conjunctive Normal Form.
53
54 >>> len(Clause([]))
55 0
56 >>> len(Clause(["A1", "A2'", "A3"]))
57 3
58 """
59 return len(self.literals)
60
61 def assign(self, model: dict[str, bool | None]) -> None:
62 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected