Question: * * * , model the following programs logic using either pseudocode or a flowchart ( or both! ) . Because this program uses functions

***, model the following programs logic using either pseudocode or a flowchart (or both!). Because this program uses functions to modularize the code, you should create SEPARATE flowcharts/pseudocode for EACH function. Do NOT try to create a single flowchart/pseudocode that captures the logic in all the functions. Pseudocode may be typed into a Word document or a text file. Flowcharts may be created using drawing shapes in a program such as Word or PowerPoint. They may also be created using an online tool such as Draw.IO *****
#Definition of the check_vowel() which returns the value based on the vowel conditions...
def check_vowel(word):
val =0
for ch in word:
if ch in ['a','e','i','o','u','A','E','I','O','U']:
val +=5
return val
#Definition of the check_consonant() which returns the value based on the given consonants conditions...
def check_consonant(word):
val =0
for ch in word.lower():
if ch in ['r','s','t','l','n']:
val +=2
return val
#Definition of the check_numeric() which returns the value based on the numeric values conditions...
def check_numeric(word):
val =0
for ch in word:
if ch in ['3','4','5','6','7']:
val +=9
return val
#Definition of the compute_value() which takes list of words...
def compute_value(wordlist):
#Set the totalValue to 0...
totalValue =0
#Call all functions and find the value...
for word in wordlist:
val =0
val += check_vowel(word)
val += check_consonant(word)
val += check_numeric(word)
#Update the totalValue...
totalValue += val
#Print the results...
print("
The value of the entire list is =", totalValue)
print("The Average per word is ={:.2f}".format(totalValue / len(wordlist)))
#Definition of the main() function...
def main():
#Declare an empty list wordlist...
wordlist =[]
#Ask user for inputs...
while True:
word = input("Enter a word (-1 to stop): ")
if word !="-1":
wordlist.append(word)
else:
break
#Call the compute_value() function...
compute_value(wordlist)
#Call the main() function...
main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!