From 95c5fb699e26c88bd05f22f0e59d935263bceabd Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Sun, 26 Feb 2023 16:09:22 +0100 Subject: [PATCH] Update GR --- scripts/growthrate.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/growthrate.py b/scripts/growthrate.py index c251625..eced385 100644 --- a/scripts/growthrate.py +++ b/scripts/growthrate.py @@ -1,8 +1,23 @@ -# input -num1 = float(input("Start: ")) -num2 = float(input("End: ")) - +# ____ _ _ ____ _ +# / ___|_ __ _____ _| |_| |__ | _ \ __ _| |_ ___ +# | | _| '__/ _ \ \ /\ / / __| '_ \ | |_) / _` | __/ _ \ +# | |_| | | | (_) \ V V /| |_| | | | | _ < (_| | || __/ +# \____|_| \___/ \_/\_/ \__|_| |_| |_| \_\__,_|\__\___| +# +# by Stephan Raabe (2023) +# --------------------------------------------------------------- +# DESC: Python script to calculate the growth rate of two numbers +# --------------------------------------------------------------- + +import rich +from rich.console import Console +from rich.prompt import FloatPrompt + +console = Console() +num1 = FloatPrompt.ask("Enter start value") +num2 = FloatPrompt.ask("Enter end value") + # printing the sum in float gr = ((num2-num1)/num1) percentage = "{:.2%}".format(gr) -print(percentage) +console.print(percentage, style="bold")