1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andrej [43]
2 years ago
14

the function must find the substrings of s that start with a vowel and end with a consonant, then print the alphabetically first

and alphabetically last of these substrings.
Computers and Technology
1 answer:
PolarNik [594]2 years ago
7 0

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.

<h3>What is the determined substrings described above?</h3>

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:
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.

You might be interested in
What is 38 - -93 + 2 x 4.6?<br> and what’s 9,220 - -2.3 x U
Degger [83]

Answer:

the first equation is 140.2

what's the last eqaution U???

Explanation:

7 0
3 years ago
What justification can you give for normalizing a database if the database will be updated only by the people who can be trusted
kakasveta [241]

Answer: C) Both a and b

Explanation:

 The main benefit of normalizing the database as it reduced the redundant data and due the lack of the redundant data, it saves lots of space in the database.

It also improve the update time in the database so it is easy to handle the database security in the system.

It is also has ability to store the dangling tuples so it can easily store all the information of the customer without introduce any inconsistencies in the database system.

Therefore, Option (C) is correct.

 

3 0
3 years ago
Information taken directly from an existing classified source and stated verbatim in a new or different document is an example o
kvv77 [185]

This is known as information extraction.

4 0
3 years ago
What are the elements of a Software Process Improvement (SPI) modle?
inn [45]

Answer: Current Situation Evaluation, Improvement Planning, Improvement Implementation, Improvement Evaluation are the elements of SPI

Explanation:

SPI modle plans to achieve a desired task of software development in terms of Current Situation Evaluation, Improvement Planning, Improvement Implementation, Improvement Evaluation, with each having a specified and detailed role to play in the software development.

5 0
4 years ago
Write a program that plays the popular scissor-rockpaper game. (A scissor can cut a paper, a rock can knock a scissor, and a pap
kolbaska11 [484]

Answer:

import random

computer = random.randint(0, 2)

user = int(input("scissor (0), rock (1), paper (2): "))

if computer == 0:

   if user == 0:

       print("The computer is scissor. You are scissor too. It is a draw")

   elif user == 1:

       print("The computer is scissor. You are rock. You won")

   elif user == 2:

       print("The computer is scissor. You are paper. Computer won")

elif computer == 1:

   if user == 0:

       print("The computer is rock. You are scissor. Computer won")

   elif user == 1:

       print("The computer is rock. You are rock too. It is a draw")

   elif user == 2:

       print("The computer is rock. You are paper. You won")

elif computer == 2:

   if user == 0:

       print("The computer is paper. You are scissor. You won")

   elif user == 1:

       print("The computer is paper. You are rock. Computer won")

   elif user == 2:

       print("The computer is paper. You are paper too. It is a draw")

Explanation:

*The code is in Python.

Import the random to be able to generate number number

Generate a random number between 0 and 2 (inclusive) using randint() method and set it to the computer variable

Ask the user to enter a number and set it to the user variable

Check the value of computer the computer variable:

If it is 0, check the value of user variable. If user is 0, it is a draw. If user is 1, user wins. If user is 2, computer wins

If it is 1, check the value of user variable. If user is 0, computer wins. If user is 1, it is a draw. If user is 2, user wins

If it is 2, check the value of user variable. If user is 0, user wins. If user is 1, computer wins. If user is 2, it is a draw

8 0
3 years ago
Other questions:
  • Which of the following is a good choice to help you stay organized when you are away from the office? A. Personal Information ma
    7·1 answer
  • Which command would you use on a switch to enable management from a remote network?
    5·1 answer
  • After a conditional formatting rule is created using the ____ dialog box, the rule is then available for use in the database fro
    11·1 answer
  • Richard Palm is the accounting clerk of Olive Limited. He uses the source documents such as purchase orders, sales invoices and
    12·1 answer
  • Can someone help me
    12·2 answers
  • Solving Systems of Equations by Substitution <br> pdf
    11·1 answer
  • Http://moomoo.io/?server=8:16:0
    6·2 answers
  • Potterheadler varmı burada​
    10·2 answers
  • How do you unblock sites on your computer
    14·2 answers
  • After 4th collision in ethernet, find the maximum time that the adapter waits until sensing the channel again for a 100 mbps bro
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!