• why should 'else' have to be in the sentence?

Question related to mission Correct Sentence

 

return text[0].upper() + text[1:] + ('.' if text[-1] != '.') <- it's what i wrote. return text[0].upper() + text[1:] + ('.' if text[-1] != '.' else '') <- it's what i saw and right

is it essential to put if and else togather in a line?