day24: adding python z3, example
This commit is contained in:
17
day24/pythonZ3/practice.py
Normal file
17
day24/pythonZ3/practice.py
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from z3 import *
|
||||
|
||||
x = Real('x')
|
||||
y = Real('y')
|
||||
|
||||
eq1 = x + y == 5
|
||||
eq2 = x - y == 3
|
||||
|
||||
s = Solver()
|
||||
s.add(eq1, eq2)
|
||||
|
||||
if s.check() == sat:
|
||||
print("Solution:", s.model())
|
||||
else:
|
||||
print("No solution found")
|
||||
Reference in New Issue
Block a user