2020# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121# SOFTWARE.
2222
23+ import os
2324from Permutation import Permutations as P
2425from Combination import Combinations as C
2526from Variation import Variations as V
@@ -39,25 +40,50 @@ def SelectOperation(option: int):
3940 V .CompoundVariation ()
4041 elif option == 6 :
4142 C .CompoundCombinatory ()
43+ else :
44+ print ("Invalid option selected, please try again." )
4245 except Exception as e :
4346 print (f"Error: { e } " )
4447
45-
46- def CombinatorialCalculus ():
47- appName = "Combinatorial Calculus"
48- version = "v1.2.0 "
49- author = "Facu Falcone"
48+ def PrintMenu () -> int :
49+ """
50+ Prints in console the menu of the app.
51+ "" "
52+ option = 0
5053 print ("Select an option from the ones below" )
5154 print ("1 - Simple Permutation.\n 2 - Simple Variation.\n 3 - Simple Combination." )
5255 print ("4 - Compound Permutation.\n 5 - Compound Variation.\n 6 - Compound Combination." )
5356 try :
5457 option = int (input ("Your option: " ))
55- SelectOperation (option )
56- exit = input ("\n Execution finished, please press a key to close the program..." )
5758 except Exception as e :
5859 print (f"Error: { e } " )
5960 finally :
61+ return option
62+
63+ def CleanScreen ():
64+ """
65+ Cleans the screen.
66+ """
67+ return lambda : os .system ('cls' )
68+
69+ def CombinatorialCalculus ():
70+ appName = "Combinatorial Calculus"
71+ version = "v1.2.0"
72+ author = "Facu Falcone"
73+ continueExec = "y"
74+
75+ while continueExec == 'y' :
6076 print (f"\n ## { appName } { version } by { author } . ##\n " )
77+ print ("#################################" )
78+
79+ option = PrintMenu ()
80+ SelectOperation (option )
81+
82+ print ("#################################" )
83+ continueExec = input ("\n Write Y to do another calculus or N to close the app: " )
84+ continueExec = continueExec .lower ()
85+ CleanScreen ()
86+
6187
6288
6389if __name__ == '__main__' :
0 commit comments