Procedural requirements
Program code
article = input(" Please enter the content you need to typeset :")
choice = int(input(" Please select the function you want to use (1. Delete the blank space 2. English punctuation replacement 3. Capitalize English words ):"))
if choice == 1:
article = article.replace(" ", "")
elif choice == 2:
choice2 = int(input(" Please select the function you want to use (1. Replace all English punctuation with Chinese punctuation 2. Replace all Chinese punctuation with English punctuation ):"))
if choice2 == 1:
article = article.replace(",", ",")
article = article.replace(".", ".")
article = article.replace(":", ":")
article = article.replace(";", ";")
article = article.replace("!", "!")
article = article.replace("?", "?")
elif choice2 == 2:
article = article.replace(",", ",")
article = article.replace(".", ".")
article = article.replace(":", ":")
article = article.replace(";", ";")
article = article.replace("!", "!")
article = article.replace("?", "?")
else:
print(" Input error, please input again !!!")
elif choice == 3:
choice3 = int(input(" Please select the function you want to use (1. title case , The rest of the letters are lowercase 2. The full text is capitalized 3. Full text words are capitalized ):"))
if choice3 == 1:
article = article.capitalize()
elif choice3 == 2:
article = article.title()
elif choice3 == 3:
article = article.upper()
else:
print(" Input error, please input again !!!")
else:
print(" Input error, please input again !!!")
print(" Content after typesetting :", article)
Running results :