summaryrefslogtreecommitdiff
path: root/comp/while/2.py
diff options
context:
space:
mode:
Diffstat (limited to 'comp/while/2.py')
-rwxr-xr-xcomp/while/2.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/comp/while/2.py b/comp/while/2.py
new file mode 100755
index 0000000..7929862
--- /dev/null
+++ b/comp/while/2.py
@@ -0,0 +1,13 @@
+import random
+
+guess = -1
+ans = random.randint(1,100)
+
+while guess != ans:
+ guess = int(input("guess: "))
+ if guess < ans:
+ print("higher")
+ elif guess > ans:
+ print("lower")
+
+