A Period Never Follows an Exclamation Mark: An Exception to the Rule
Double punctuation is ugly, but unavoidable sometimes. For example, it appears in dialogue: He said, "I try to avoid double punctuation." The period and closing quote bump against each other, and nothing can be done about it. Other examples are given in this nice article on double punctuation: https://www.subversivecopyeditor.com/blog/2010/08/double-punctuation.html (check out the comments section of the article for a ringside view of a grammatical kerfuffle that has nothing to do with the subject of the article!).
A rule given in that article is this: "A period never follows an exclamation mark or question mark." It is a rule that must've been deeply ingrained in me, because recently I automatically, without any thought, deleted a period that appeared after an exclamation mark at the end of a sentence.
It was only after the author asked me if the period really needed to go that I thought about it. A little research uncovered the truth: the author was right. The period had to stay.
You see, this was mathematical copy, and the exclamation mark represented a factorial. If a sentence ends with a factorial, a period has to appear after the exclamation mark; otherwise, the sentence would be ambiguous. For example, consider "The answer is obtained by multiplying the variable by 5!" What does the exclamation mark represent here? Is it an interjection? Or does it denote a factorial? Only the context can tell us, and context is not always a reliable guide. In our sentence, if the exclamation mark denotes a factorial, a period should follow it: "The answer is obtained by multiplying the variable by 5!."
Now there's no ambiguity: the period excludes the interjection. So, the factorial is an exception to the "A period never follows an exclamation mark" rule.