Weekly Challenge #3 – Sentence Repetition

To complete these challenges, you should become familiar with splitting strings. These help you split a string into a list/array of individual words. For the gold challenge, you may also want to view my tutorial on selecting random items from a list in Python.

Bronze

Write a program which asks the user to enter a sentence. The program should then output the sentence, but with the first word of the sentence repeated at the end of the sentence.

For example: “Hello Word” would become “Hello World Hello”

Silver

Extend your program so that the program now also repeats the last word of the sentence after it has repeated the first word. 

For example: “The medium challenge” would become “The medium challenge The challenge”

Gold

The program is to now become a game, where the user is presented with a random sentence. The user must then type in the sentence, following the rules from the previous challenges (Repeat the first word at the end, followed by the last word). 

The sentence should be generated from a list of words, you can use the following if it helps.

["BRUSH", "CHUBBY", "BOARD", "LOAD", "PRODUCE", "DESERVE", "HURRIED", "ROT", "CHICKEN", "ABRUPT", "WHISTLE", "SHOP", "MAN", "JINGLE", "FORGETFUL", "STARK", "CRICKET", "FIXED", "HILL", "EARTHY"]

Your program should then inform the user whether or not they have entered the sentence correctly.

Good luck!