Nov-10-2022, 02:38 PM
To show code a example that works fine for task like this
So it's like deanhystad code taken a little futher,
so menu function is where start and always fall back into after run a function.
Then can restart an other task or Quit out.
So it's like deanhystad code taken a little futher,
so menu function is where start and always fall back into after run a function.
Then can restart an other task or Quit out.
from rich import print def cargo_calc(): '''This is how to get the volumetric weight for cargo space calculation''' num1 = input('Enter length number: ') num2 = input('Enter width number: ') num3 = input('Enter height number: ') return float(num1) * float(num2) * float(num3) / 5000 def shipment_calc(): '''Not finish yet''' pass def menu_choies(): return '''\ (1) Cargo space calculation) (2) shipment space calculation) ([bold red]Q[/bold red]) Quit\n''' def menu(): while True: print(menu_choies()) choice = input('Enter your choice: ').lower() if choice == '1': print(f'Volumetric weight for cargo is {cargo_calc()}\n') elif choice == '2': shipment_calc() elif choice == 'q': return else: print(f'Not a correct choice: {choice},try again\n') if __name__ == '__main__': menu()Also trown in Rich for some colors which work for on all OS/shell even
cmd
🧵.