diff options
author | standenboy <standenboy@seacrossedlovers.xyz> | 2023-12-15 10:19:20 +0000 |
---|---|---|
committer | standenboy <standenboy@seacrossedlovers.xyz> | 2023-12-15 10:19:20 +0000 |
commit | 4a95719d58a708ad55b1389631d6339047f786a0 (patch) | |
tree | 26cb6fc2dbe7fa75f57f1d6fb13aff8955772b56 /comp/while |
added existing work
Diffstat (limited to 'comp/while')
-rwxr-xr-x | comp/while/1.py | 10 | ||||
-rwxr-xr-x | comp/while/2.py | 13 |
2 files changed, 23 insertions, 0 deletions
diff --git a/comp/while/1.py b/comp/while/1.py new file mode 100755 index 0000000..08a4e21 --- /dev/null +++ b/comp/while/1.py @@ -0,0 +1,10 @@ +num = 0 +highest = 0 +lowest = 0 +while num != -1: + num = int(input("num: ")) + if num > highest: + highest = num + if num < lowest: + lowest = num +print("the highest value was",highest,"and the lowest value was",lowest) 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") + + |