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

Method __str__

other/davis_putnam_logemann_loveland.py:41–48  ·  view source on GitHub ↗

To print a clause as in Conjunctive Normal Form. >>> str(Clause(["A1", "A2'", "A3"])) "{A1 , A2' , A3}"

(self)

Source from the content-addressed store, hash-verified

39 self.literals: dict[str, bool | None] = dict.fromkeys(literals)
40
41 def __str__(self) -> str:
42 """
43 To print a clause as in Conjunctive Normal Form.
44
45 >>> str(Clause(["A1", "A2'", "A3"]))
46 "{A1 , A2' , A3}"
47 """
48 return "{" + " , ".join(self.literals) + "}"
49
50 def __len__(self) -> int:
51 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected