idk what we edited
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 12s
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 12s
Co-authored-by: seaswimmerthefsh@gmail.com <seaswimmerthefsh@gmail.com>
This commit is contained in:
parent
b84f62cb59
commit
4937c519fa
3 changed files with 13 additions and 6 deletions
5
division/README.md
Normal file
5
division/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Division
|
||||||
|
|
||||||
|
## 04/29/2024
|
||||||
|
|
||||||
|
wip
|
|
@ -2,7 +2,8 @@
|
||||||
BLUE = "\033[34m" # Blue
|
BLUE = "\033[34m" # Blue
|
||||||
RED = "\033[31m" # Red
|
RED = "\033[31m" # Red
|
||||||
GREEN = "\033[32m" # Green
|
GREEN = "\033[32m" # Green
|
||||||
RESET = "\033[0m" # Reset to default color
|
RESET = "\033[0m" # Reset to default color
|
||||||
|
|
||||||
|
|
||||||
def divide(x: float, y: float) -> float | None:
|
def divide(x: float, y: float) -> float | None:
|
||||||
try:
|
try:
|
||||||
|
@ -12,12 +13,13 @@ def divide(x: float, y: float) -> float | None:
|
||||||
return print(f"{RED}You cannot divide by strings!{RESET}")
|
return print(f"{RED}You cannot divide by strings!{RESET}")
|
||||||
|
|
||||||
if y == 0:
|
if y == 0:
|
||||||
return print(f"{RED}You cannot divide by 0!{RESET}") # you don't divide by zero
|
return print(f"{RED}You cannot divide by 0!{RESET}") # you don't divide by zero
|
||||||
return float(x/y)
|
return float(x / y)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
x = input(f"{BLUE}Input a number to divide:{RESET} ")
|
x = input(f"{BLUE}Input a number to divide:{RESET} ")
|
||||||
y = input(f"{BLUE}Input a number to divide by:{RESET} ")
|
y = input(f"{BLUE}Input a number to divide by:{RESET} ")
|
||||||
result = divide(x,y)
|
result = divide(x, y)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
print(f"{GREEN}{result}{RESET}")
|
print(f"{GREEN}{result}{RESET}")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Online Store
|
# Online Store
|
||||||
|
|
||||||
## 04/29/2024
|
## 04/26/2024
|
||||||
|
|
||||||
wip
|
wip
|
||||||
|
|
Loading…
Reference in a new issue