diff options
Diffstat (limited to 'comp/work/2')
-rwxr-xr-x | comp/work/2/fstring.py | 4 | ||||
-rwxr-xr-x | comp/work/2/pi.py | 2 | ||||
-rwxr-xr-x | comp/work/2/shops.py | 25 | ||||
-rwxr-xr-x | comp/work/2/syntaxError | 6 |
4 files changed, 37 insertions, 0 deletions
diff --git a/comp/work/2/fstring.py b/comp/work/2/fstring.py new file mode 100755 index 0000000..80d7d7c --- /dev/null +++ b/comp/work/2/fstring.py @@ -0,0 +1,4 @@ +red = "\e[1;35m" +normal = "\e[0;37m" + +print(f"{red}hello{normal}") diff --git a/comp/work/2/pi.py b/comp/work/2/pi.py new file mode 100755 index 0000000..93f216d --- /dev/null +++ b/comp/work/2/pi.py @@ -0,0 +1,2 @@ +import math +print(f"{math.pi:.48f}") diff --git a/comp/work/2/shops.py b/comp/work/2/shops.py new file mode 100755 index 0000000..57cff25 --- /dev/null +++ b/comp/work/2/shops.py @@ -0,0 +1,25 @@ +total = int(input("how much does it cost: ")) +totalPayed = int(input("how much did you get: ")) + +if totalPayed < total: + print(f"{totalPayed:.2f} is not enough to pay for {total:.2f}") + exit() + +totalChange = totalPayed - total +changeToGive = [] +while totalChange != 0: + if totalChange >= 10: + totalChange = totalChange - 10 + changeToGive.append(10) + elif totalChange >= 5: + totalChange = totalChange - 5 + changeToGive.append(5) + elif totalChange >= 2: + totalChange = totalChange - 2 + changeToGive.append(2) + elif totalChange >= 1: + totalChange = totalChange - 1 + changeToGive.append(1) + +print(f"you need to give the customer : {changeToGive}") + diff --git a/comp/work/2/syntaxError b/comp/work/2/syntaxError new file mode 100755 index 0000000..988177a --- /dev/null +++ b/comp/work/2/syntaxError @@ -0,0 +1,6 @@ +print = ("....") print("...") + ^ +heigth-Str = input("...") height = int(input("...")) + ^ +base-Str = input("...") base = int(input("...")) + ^ |