@@ -7,9 +7,9 @@ def maxof_three():
77 str2 = input ("Enter string 2: " )
88 str3 = input ("Enter string 3: " )
99 maxstr = ""
10- if len ( str1 ) > len ( str2 ) and len ( str1 ) > len ( str3 ) :
10+ if str1 > str2 and str1 > str3 :
1111 maxstr = str1
12- elif len ( str2 ) > len ( str1 ) and len ( str2 ) > len ( str3 ) :
12+ elif str2 > str1 and str2 > str3 :
1313 maxstr = str2
1414 else :
1515 maxstr = str3
@@ -45,31 +45,33 @@ def palindrome():
4545 else :
4646 print (f"{ str } is not a palindrome" )
4747
48+ def main ():
49+ print ("\n Menu" )
50+ print ("-" * 20 )
51+ print ("1. Length of string" )
52+ print ("2. Maximum of three strings" )
53+ print ("3. Replace vowels with '#'" )
54+ print ("4. No. of words" )
55+ print ("5. Check Palindrome" )
56+ print ("6. Exit" )
57+ print ("-" * 20 )
58+ option = input ("Your choice: " )
59+
60+ switcher = {
61+ '1' : len_str ,
62+ '2' : maxof_three ,
63+ '3' : replace_vowels ,
64+ '4' : numofwords ,
65+ '5' : palindrome ,
66+ '6' : quit
67+ }
68+ func = switcher .get (option , lambda : print ("Invalid Choice!" ))
69+ func ()
70+
4871if __name__ == "__main__" :
4972
5073 ch = 'y'
5174 while ch .lower () == 'y' :
52- print ("\n Menu" )
53- print ("-" * 20 )
54- print ("1. Length of string" )
55- print ("2. Maximum of three strings" )
56- print ("3. Replace vowels with '#'" )
57- print ("4. No. of words" )
58- print ("5. Check Palindrome" )
59- print ("6. Exit" )
60- print ("-" * 20 )
61- option = input ("Your choice: " )
62-
63- switcher = {
64- '1' : len_str ,
65- '2' : maxof_three ,
66- '3' : replace_vowels ,
67- '4' : numofwords ,
68- '5' : palindrome ,
69- '6' : quit
70- }
71- func = switcher .get (option , lambda : print ("Invalid Choice!" ))
72- func ()
73-
75+ main ()
7476 ch = input ("\n Want to continue? [y/n]: " )
7577
0 commit comments