Code: Using the following text file that contains a list of first names, give the regular expression for each of the following questions:   a) return all the names that contain two or more consecutive vowels (i.e.: ae, ou, eau etc.)   b) return all names that the first letter are in between letters A – M and the last letter in between N – Z   c) return all names that contain a hyphen anywhere within the name, the first letter begins with a consonant and the last letter with a vowel (satisfies all conditions).

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question

Python Code:

Using the following text file that contains a list of first names, give the regular expression for each of the following questions:

 

  1. a) return all the names that contain two or more consecutive vowels (i.e.: ae, ou, eau etc.)

 

  1. b) return all names that the first letter are in between letters A – M and the last letter in between N – Z

 

  1. c) return all names that contain a hyphen anywhere within the name, the first letter begins with a consonant and the last letter with a vowel (satisfies all conditions).

 

  1. d) return all names that have no vowels, have duplicate consonants (such as “tt”, “ll”) and is between 3 and 10 characters long in length.

 

Integrate your regex solution into a python script that opens the file and then prints the results for each response to the console.

 

first-names.txt

Aaren
Aarika
Abagael
Abagail
Abbe
Abbey
Abbi
Abbie
Abby
Abbye
Abigael
Abigail
Abigale
Abra
Ada
Adah
Adaline
Adan
Adara
Adda
Addi
Addia
Addie
Addy
Adel
Adela
Adelaida
Adelaide
Adele
Adelheid
Adelice
Adelina
Adelind
Adeline
Adella
Adelle
Adena
Adey
Adi
Adiana
Adina
Adora
Adore
Adoree
Adorne
Adrea
Adria
Adriaens
Adrian
Adriana
Adriane
Adrianna
Adrianne
Adriena
Adrienne
Aeriel
Aeriela
Aeriell
Afton
Ag
Agace
Agata
Agatha
Agathe
Aggi
Aggie
Aggy
Agna
Agnella
Agnes
Agnese
Agnesse
Agneta
Agnola
Agretha
Aida
Aidan
Aigneis
Aila
Aile
Ailee
Aileen
Ailene
Ailey
Aili
Ailina
Ailis
Ailsun
Ailyn
Aime
Aimee
Aimil
Aindrea
Ainslee
Ainsley
Ainslie
Ajay
Alaine
Alameda
Alana
Alanah
Alane
Alanna
Alayne
Alberta
Albertina
Albertine
Albina
Alecia
Aleda
Aleece
Aleen
Alejandra
Alejandrina
Alena
Alene
Alessandra
Aleta
Alethea
Alex
Alexa

Alexandra
Alexandrina
Alexi
Alexia
Alexina
Alexine
Alexis
Alfi
Alfie
Alfreda
Alfy
Ali
Alia
Alica
Alice
Alicea
Alicia
Alida
Alidia
Alie
Alika
Alikee
Alina
Aline
Alis
Alisa
Alisha
Alison
Alissa
Alisun
Alix
Aliza
Alla
Alleen
Allegra
Allene
Alli
Allianora
Allie
Allina
Allis
Allison
Allissa
Allix
Allsun
Allx
Ally
Allyce
Allyn
Allys
Allyson
Alma
Almeda
Almeria
Almeta
Almira
Almire
Aloise
Aloisia
Aloysia
Alta
Althea
Alvera
Alverta
Alvina
Alvinia
Alvira
Alyce
Alyda
Alys
Alysa
Alyse
Alysia
Alyson
Alyss
Alyssa
Amabel
Amabelle
Amalea
Amalee
Amaleta
Amalia
Amalie
Amalita
Amalle
Amanda
Amandi
Amandie
Amandy
Amara
Amargo
Amata
Amber
Amberly
Ambur
Ame
Amelia
Amelie
Amelina
Ameline
Amelita
Ami
Amie
Amii
Amil
Amitie
Amity
Ammamaria
Amy
Amye
Ana

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning