From 4a95719d58a708ad55b1389631d6339047f786a0 Mon Sep 17 00:00:00 2001 From: standenboy Date: Fri, 15 Dec 2023 10:19:20 +0000 Subject: added existing work --- comp/work/6/5timesTable.py | 8 ++++++++ comp/work/6/cake.py | 8 ++++++++ comp/work/6/iceCream.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100755 comp/work/6/5timesTable.py create mode 100755 comp/work/6/cake.py create mode 100755 comp/work/6/iceCream.py (limited to 'comp/work/6') diff --git a/comp/work/6/5timesTable.py b/comp/work/6/5timesTable.py new file mode 100755 index 0000000..e7be413 --- /dev/null +++ b/comp/work/6/5timesTable.py @@ -0,0 +1,8 @@ +num = int(input("number: ")) + +if num < 0: + exit(1) + +for i in range(num+1): + if (i % 5) == 0: + print(i) diff --git a/comp/work/6/cake.py b/comp/work/6/cake.py new file mode 100755 index 0000000..23f4e44 --- /dev/null +++ b/comp/work/6/cake.py @@ -0,0 +1,8 @@ +while True: + eggs = int(input("how many eggs are there: ")) + if eggs < 8: + break +flour = eggs * 100 +sugar = eggs * 50 + +print("you will need", flour, "grams and", sugar, "grams") diff --git a/comp/work/6/iceCream.py b/comp/work/6/iceCream.py new file mode 100755 index 0000000..10db61c --- /dev/null +++ b/comp/work/6/iceCream.py @@ -0,0 +1,29 @@ +while True: + week = input("is it a week day: (yes/no) ").lower() + if week == "yes": + break + elif week == "no": + break + +while True: + temp = int(input("what is the temprature: ")) + if temp >= 20: + if temp <= 45: + break +sold = 0 +if week == "no": + if 20 <= temp <= 30: + sold = 200 + elif 31 <= temp <= 38: + sold = 300 + else: + sold = 240 +elif week == "yes": + if 20 <= temp <= 30: + sold = 200/2 + elif 31 <= temp <= 38: + sold = 300/2 + else: + sold = 240/2 +print(sold, "ice creams will be sold") + -- cgit v1.2.3