Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6.19 Ch 6 Program: Authoring assistant (Python 3) The \'r - Replace punctuation\

ID: 3881448 • Letter: 6

Question

6.19 Ch 6 Program: Authoring assistant (Python 3)

The 'r - Replace punctuation' should only be seen once, the images didnt paste properly.

6.19 Ch 6 Program: Authoring assistant (Python 3) (1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt) Ex: Enter a sample text: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yesi more volunteers, more civilians, more teachers in space. nothing ends here our hopes and our journeys continue! You entered: we'1l continue our quest in space there will be more shuttle flights and more shuttle crews and, yesi more volunteers, more civilians, more teachers in spacenothing ends here our hopes and our journeys continue! (2) Implement a print menu0 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 printmenu0 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 menu0 in the main section of your code. Continue to call print menu0 until the user enters q to Quit. (3 pts) EX: MENU c-Number of non-whitespace characters - Number of words f Pix capitalization r- Replace punctuation

Explanation / Answer

def print_menu(s):#function definition takes a input string and returns the matched option
#declaring variables
c="Number of non-whitespace character"
w="Number of words"
f="Fix capitalization"
r="Replace punctuation"
s="Shorten spaces"
q="Quit"
#returning appropritae choice
if(s=="c"):
return(c)
elif(s=="w"):
return(w)
elif(s=="f"):
return(f)
elif(s=="r"):
return(r)
elif(s=="s"):
return(s)
elif(s=="q"):
return(q)
  

n = input("Enter string :")#asking input
print("You Entered :",n)
s = input("MENU c - Number of non-whitespace character f - Number of words r - Replace punctuation s - Shorten spaces q - Quit Choose an option:")
m=print_menu(s)
print("Option selected :",m)#calling function for an option