Explore Westonci.ca, the leading Q&A site where experts provide accurate and helpful answers to all your questions. Get detailed answers to your questions from a community of experts dedicated to providing accurate information. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.
Sagot :
According to the parameters given in the questions above, the alphabetically lowest and highest substrings that start with a vowel and end with a Consonant is given below.
What is the determined substrings described above?
The determined substring is given by the following:
def findSubstrings(s):
sub_strings_list=[] #the required substrings list
vowels=['a','e','i','o','u'] #vowels list
for i in range(0,len(s)):
for j in range(i+1,len(s)+1):
sub_string=s[i:j] #slicing the original string into substring
#checking whether the substring starts with a vowel and ends with a consonant
if(sub_string[0] in vowels and sub_string[-1] not in vowels):
if(sub_string not in sub_strings_list): #checking if the substring is already in the list
sub_strings_list.append(sub_string) #if all conditions are satisfied adding the substring to the list
sub_strings_list.sort() #sorting the list alphabetically
print(sub_strings_list[0]) #printing the first substring in the list
print(sub_strings_list[-1]) #printing the last substring in the list
s=input()
findSubstrings(s)
Learn more about substrings:
https://brainly.com/question/21306076
#SPJ4
Full Question:
Consider a string, s — An alphabetically-ordered sequence Of Of s would be {"a", "ab•, "abc • , "bcu, If the sequence is reduced to only those substrings that start with a vowel and end with a consonant, the result is Cab", •abc"}. The alphabetically first element in this reduced list is •ab", and the alphabetically last element is "abc'. As a reminder:
Vowels: a, e, i, o, and u.
Consonants: b, c, d, f, g, h, i, k, l, m, n, p, q, r, s, t, v, w, x, y, and z.
For a given string, determine the alphabetically lowest and highest substrings that start with a vowel and end with a Consonant.
Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. We're glad you chose Westonci.ca. Revisit us for updated answers from our knowledgeable team.