From d97c6ac931138bcd1761270de68871b3054fac3b Mon Sep 17 00:00:00 2001 From: sascha Date: Thu, 7 Mar 2024 10:23:59 +0000 Subject: [PATCH] meow --- agree.py | 8 ++++++++ calculator.py | 10 ++++++++++ compare.py | 11 +++++++++++ meow.py | 8 ++++++++ 4 files changed, 37 insertions(+) create mode 100644 agree.py create mode 100644 calculator.py create mode 100644 compare.py create mode 100644 meow.py diff --git a/agree.py b/agree.py new file mode 100644 index 0000000..bde83f4 --- /dev/null +++ b/agree.py @@ -0,0 +1,8 @@ +s = input("Do you agree? ") + +s = s.lower() + +if s in ["y", "yes"]: + print("Agreed.") +elif s in ["n", "no"]: + print("Not agreed.") \ No newline at end of file diff --git a/calculator.py b/calculator.py new file mode 100644 index 0000000..b2d0875 --- /dev/null +++ b/calculator.py @@ -0,0 +1,10 @@ +x = (float)(input("x: ")) +y = (float)(input("y: ")) + +print(f"x + y = {x + y}") +print(f"x - y = {x - y}") +print(f"x * y = {x * y}") +print(f"x / y = {x / y}") + +z = x / y +print(f"x / y = {z:.50f}") \ No newline at end of file diff --git a/compare.py b/compare.py new file mode 100644 index 0000000..15a8bff --- /dev/null +++ b/compare.py @@ -0,0 +1,11 @@ +from cs50 import get_int + +x = get_int("x: ") +y = get_int("y: ") + +if x < y: + print("x is less than y") +elif x > y: + print("x is greater than y") +else: + print("x is equal to y") \ No newline at end of file diff --git a/meow.py b/meow.py new file mode 100644 index 0000000..8198267 --- /dev/null +++ b/meow.py @@ -0,0 +1,8 @@ +def main(): + meow(30) + +def meow(n): + for i in range(n): + print(f"{i}: Meow!") + +main() \ No newline at end of file