Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# the list below has some 7-letter words: my_list = ['qabalah','qasidas', 'qigongs','qindars','qintars','qiviuts','quacked', 'orchids','chamber','phoenix','central','juggler','dungeon','passive', 'capable','creator','rabbits','succeed','compute','achieve','attempt', 'network','address','supreme','believe','concern','explore','finance', 'quadric','quaered','quaeres','quaffed','quaffer','quaggas','quahaug', 'benifit','license','carcass','abalone','morning','abandon','macabre', 'teacher','billion','yankees','mistake','suspect','barrack','connect', 'operate','cabbage','ability','rushing','passion','perfect','fashion', 'outputs','success','banking','journal','quaichs','quaighs','quailed', 'douleia','eulogia','miaoued','moineau','sequoia','toxemia','sodaine', 'yibbles','yickers','yielded','yielder','yikkers','yippers','yippies', 'yipping','yirding','yirking','yirring','ymolten','ynambus','yobbery', 'yobbish','yobbism','yobboes','yocking','yodeled','yodeler','yodlers',

# the list below has some 7-letter words:
my_list = \
['qabalah','qasidas', 'qigongs','qindars','qintars','qiviuts','quacked',
'orchids','chamber','phoenix','central','juggler','dungeon','passive',
'capable','creator','rabbits','succeed','compute','achieve','attempt',
'network','address','supreme','believe','concern','explore','finance',
'quadric','quaered','quaeres','quaffed','quaffer','quaggas','quahaug',
'benifit','license','carcass','abalone','morning','abandon','macabre',
'teacher','billion','yankees','mistake','suspect','barrack','connect',
'operate','cabbage','ability','rushing','passion','perfect','fashion',
'outputs','success','banking','journal','quaichs','quaighs','quailed',
'douleia','eulogia','miaoued','moineau','sequoia','toxemia','sodaine',
'yibbles','yickers','yielded','yielder','yikkers','yippers','yippies',
'yipping','yirding','yirking','yirring','ymolten','ynambus','yobbery',
'yobbish','yobbism','yobboes','yocking','yodeled','yodeler','yodlers',
'yodling','yoghurt','yoginis','yogisms','yogurts','yohimbe','yoicked',
'yojanas','yokings','yokking','yolkier','yomping','yonders','yonkers',
'yoppers','yorkers','yorkies','yorking','youking','younger','youngly',
'youngth','younker','youpons','youthen','youthly','yowlers','yowleys',
'yowling','yperite','yplight','ypsilon','yshends','yslaked','yttrias',
'yttrium','yuchier','yuckers','yuckier','yucking','yukatas','yukiest',
'yukkier','yukking','yummier','yummies','yumpies','yumping','yuppies']
# Let us categorize odd-length words as: leftists, rightists, and centrists.
# Leftists words have more vowels (a,e,i,o,u) in the first 3 consecutive
# letters than the last 3 consecutive letters. An example is youthly: the first
# 3 letters (y,o,u) contain more vowels than the last 3 letters (h,l,y)
# Similarly, Rightists words have more vowels in the last 3 consecutive letters
# than the first 3 consecutive letters. An example is dungeon: the last 3
# letters (e,o,n) contain more vowels than the first 3 letters (d,u,n)
# Finally, Centrists words are balanced and have equal number of vowels on
# both sides. An example is yodeled: the first 3 letters (y,o,d) has 1 vowel,
# and so does the last 3 letters (l,e,d)
# Write python code that prints a single value (A+B+C) as defined below:
#
# A = number of centrists words from my_list where the words have at least
# 3 letters in common with MY_WORD. As an example: if MY_WORD is orchids
# then morning is such a centrists word (common letters are o,r,i)
#
# B = number of leftists words from my_list where the Nth index letter of
# the word exists in MY_WORD. Here, N is the smallest digit of MY_NUM.
# In your case if N > 6, use N=6. As an example: if MY_WORD is orchids
# and MY_NUM is 10233, then outputs is such a leftists word - the
# letter in 0th index is o and it exists in orchids.
#
# C = number of rightists words from my_list where middle 5 letters of that
# word has at least one letter in common with MY_WORD. As an example:
# if MY_WORD is orchids, then sequoia is such a word -- the middle
# 5 letters (equoi) has i and o in common with orchids.
#
# once you compute A, B, and C, please set my_result = A + B + C.
# it has been initialized to 0.
my_result = 0
###############################################################################
# please do not modify these last few lines. They will be used to evaluate your
# exam. If you have used any print statements in your own code, please comment
# them out.
print(f'Q4:my_result:{my_result}')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions