Oct-07-2019, 01:59 PM
First, I hope I used the format/rules correctly.
I did a search for "embedding return in a print statement" before posting. I don't have the terminology down and may not be asking a syntactically correct question. If that's not a proper way to word the question I'm asking, please identify the correct way to word it if you would.
The last line of the code gives me the correct return. I want that same return embedded in the previous print statement but don't know the correct structure and would be appreciative of knowing/seeing it.
Thanks in advance.
I did a search for "embedding return in a print statement" before posting. I don't have the terminology down and may not be asking a syntactically correct question. If that's not a proper way to word the question I'm asking, please identify the correct way to word it if you would.
The last line of the code gives me the correct return. I want that same return embedded in the previous print statement but don't know the correct structure and would be appreciative of knowing/seeing it.
Thanks in advance.
print("Word Counter")
print("The purpose of the word counter is to enter the count of the number of words in a sentence entered into the system by the user.")
sentence = input("Enter the sentence you would like to test. When done, press Enter."'\n')
print("The sentence you entered is:")
print(sentence)
print("In your sentence, the number of words is: (len(sentence.split(' ')))")
print(len(sentence.split(' ')))
