Skip to content

Commit 38a97e8

Browse files
committed
Update output of Berger example for Py3 strings
1 parent 1d85d79 commit 38a97e8

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

examples/bergerexample.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,15 @@ def f2(x):
4949
p = model.probdist()
5050
for j in range(len(model.samplespace)):
5151
x = model.samplespace[j]
52-
print(("\tx = %-15s" %(x + ":",) + " p(x) = "+str(p[j])).encode('utf-8'))
52+
print("\tx = %-15s" %(x + ":",) + " p(x) = "+str(p[j]))
5353

5454

5555
# Now show how well the constraints are satisfied:
5656
print()
5757
print("Desired constraints:")
5858
print("\tp['dans'] + p['en'] = 0.3")
59-
print(("\tp['dans'] + p['" + a_grave + "'] = 0.5").encode('utf-8'))
59+
print("\tp['dans'] + p['" + a_grave + "'] = 0.5")
6060
print()
6161
print("Actual expectations under the fitted model:")
6262
print("\tp['dans'] + p['en'] =", p[0] + p[1])
63-
print(("\tp['dans'] + p['" + a_grave + "'] = " + str(p[0]+p[2])).encode('utf-8'))
64-
# (Or substitute "x.encode('latin-1')" if you have a primitive terminal.)
63+
print("\tp['dans'] + p['" + a_grave + "'] = " + str(p[0]+p[2]))

0 commit comments

Comments
 (0)