Skip to content

Commit bec160c

Browse files
author
cclauss
authored
Use strip() to deal with leading or trailing whitespace
1 parent ee3b0f2 commit bec160c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hashes/chaos_machine.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from __future__ import print_function
33

44
try:
5-
raw_input # Python 2
5+
input = raw_input # Python 2
66
except NameError:
7-
input = raw_input # Python 3
7+
pass # Python 3
88

99
# Chaos Machine (K, t, m)
1010
K = [0.33, 0.44, 0.55, 0.44, 0.33]; t = 3; m = 5
@@ -100,7 +100,7 @@ def reset():
100100
inp = ""
101101

102102
# Pulling Data (Output)
103-
while inp != "e" and inp != "E":
103+
while inp in ("e", "E"):
104104
print("%s" % format(pull(), '#04x'))
105105
print(buffer_space); print(params_space)
106-
inp = input("(e)exit? ")
106+
inp = input("(e)exit? ").strip()

0 commit comments

Comments
 (0)