Reference no: EM132364575
Introduction to Programming Assignment -
Purpose of the assessment - Assess student's ability to develop algorithmic solutions to programming problems using Python language.
Assignment Specifications -
Purpose: This assignment evaluates your understanding of basic programming principles using Python language. In particular, it assesses your ability to develop algorithms to solve simple problems, successfully run python programs, and your ability to write meaningful comments when required.
1. You may have noticed that some English words can be read both ways (from left to right or right to left). For example, Kayak, Racecar and Madam can all be read both ways. Most words however can only be read from left to right, for example, Melbourne, Python and Holmes. Write a program (name it, checkWord.py) that finds out if a given word can be read both ways. The program prompts the user to enter a word, and then either prints "Both ways" or "One way" as an output.
2. Write a program (name it, unique.py) that takes a text message as an input and prints out the same message, however with unique words only. In other words, all words repeated within the text must only appear once. You need to remove all punctuation marks from the returned message. Punctuation marks include ". , ; : ? !"
3. Three pets live in a happy house: dog, cat and a mouse. The dog often chases the cat, the cat likes to chase the mouse, however the mighty dog runs away when it sees the mouse. Develop a game (let's call it happyHouse.py) which can be played by two players. The program asks the two players (player1 and player2) to choose either 1 for dog, 2 for cat, or 3 for mouse. The rules for this game are simple:
The dog prevails over the cat.
The cat prevails over the mouse.
The mouse prevails over the dog.
So if player1 chooses a dog and player2 chooses a cat, player1 wins. If player1 chooses a dog and player2 chooses a mouse, player2 wins, and so forth. If both players choose the same pet, then the result will be draw. The players continue playing until either player hits enter without choosing a number (1, 2 or 3). Each time the game is run, the result is printed on the screen (for example, Player 1 wins or Player 2 wins).
Hint:
Define an indefinite loop which only breaks when either player enters an empty string (hits enter with no entry).
Within the loop, prompt Player 1 and Player 2 to enter 1 for dog, 2 for cat or 3 for mouse.
Based on the choices made by Player 1 and Player 2, your program prints out the appropriate message, which can either be "draw", "Player 1 wins" or "Player 2 wins".
Attachment:- Introduction to Programming Assignment File.rar