219k views
3 votes
Implement a print_menu() function, which has a string as a parameter, outputs a menu of user options for analyzing/editing the string, and returns the user's entered menu option and the sample text string (which can be edited inside the print_menu() function). Each option is represented by a single character. If an invalid character is entered, continue to prompt for a valid choice. Hint: Implement the Quit menu option before implementing other options. Call print_menu() in the main section of your code. Continue to call print_menu() until the user enters q to Quit. (3 pts)

1 Answer

3 votes

Answer:

def print_menu():

print("MENU')

print("c-Number of non-whitespace characters\\w - Number of words\\f-Fix capitalization\\r

Replace punctuation\\s - Shorten spaces\\q - Quity

print("\\ Choose an option: ")

#################################

def get_num_of_non_WS_characters (s):

count = 0

for x in s

if not x is ‘ ‘:

count +=1

return count

Step-by-step explanation:

Computers are very quick and more efficient when it comes to performing the various tasks we give them on a daily basis, sometimes things can get a bit unenergetic and we find that your PC stalls or ‘freezes altogether’.

While technically speaking, "force quit" is a term applied to Apple's Mac computers, the same premise applies to ‘Windows-based PCs’.