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

Write a program to build a sentence based on a random number of words entered by

ID: 3907779 • Letter: W

Question

Write a program to build a sentence based on a random number of words entered by the user.
The random number of words is to be generated by the program and should be an integer between five and twelve.
The program should request a separate input for each word entered (only enter one word at a time).
Print the complete sentence in uppercase with an exclamation point at the end.

Use only python code, functions, methods and data structures that we have used in our course (this means not using/copying code you have encountered outside of assigned course materials). AND NAME THIS RANDOM .PY AND SEND THE OUTPUT

Explanation / Answer

from random import randint words = [] while True: word = input('Enter a word(quit to exit): ') if word == 'quit': break words.append(word) sentence = [] size = randint(5, 12) for i in range(size): sentence.append(words[randint(0, len(words)-1)]) print('Sentence is: ' + ' '.join(sentence) + '!')

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote