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

Method __str__

other/davis_putnam_logemann_loveland.py:113–120  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

111 self.clauses = list(clauses)
112
113 def __str__(self) -> str:
114 """
115 To print a formula as in Conjunctive Normal Form.
116
117 >>> str(Formula([Clause(["A1", "A2'", "A3"]), Clause(["A5'", "A2'", "A1"])]))
118 "{{A1 , A2' , A3} , {A5' , A2' , A1}}"
119 """
120 return "{" + " , ".join(str(clause) for clause in self.clauses) + "}"
121
122
123def generate_clause() -> Clause:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected