This commit is contained in:
Stefan Spangenberg
2023-10-19 15:42:05 +02:00
parent 4b3a0488cc
commit 800a6b61af
98 changed files with 9212 additions and 0 deletions

23
scripts/growthrate.py Normal file
View File

@ -0,0 +1,23 @@
# DESC: Python script to calculate the growth rate of two numbers
import rich
import pyperclip
from rich.console import Console
from rich.prompt import FloatPrompt
# Show prompts
console = Console()
num1 = FloatPrompt.ask("Old value")
num2 = FloatPrompt.ask("New value")
# Calculate the growth rate
gr = ((num2-num1)/num1)
percentage = "{:.2%}".format(gr)
# Print result to the console
console.print(percentage, style="bold")
# Copy result into the system clipboard
pyperclip.copy(percentage)
print("Result has been copied to the clipboard!")