Finds out if a given word can be read both ways

Assignment Help Python Programming
Reference no: EM132366759

Purpose of the assessment - Assess student's ability to develop algorithmic solutions to programming problems using Python language.

Individual 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.

For example:
If the input word is: "Kayak" The output would be: Both ways

If the input word is: "Holmes" The output would be: One way

Hint:
• Start by prompting the user for a word
• Convert the word into small letters
• Write the rest of the program

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 ". , ; : ? !"

For example:
If the input message is: "You're an insomniac, you tell yourself: there are profound truths revealed only to the insomniac by night like those phosphorescent minerals veined and glimmering in the dark but coarse and ordinary otherwise; you have to examine such minerals in the absence of light to discover their beauty, you tell yourself."

The output message would be: "you're an insomniac you tell yourself there are profound truths revealed only to the by night like those phosphorescent minerals veined and glimmering in dark but coarse ordinary otherwise have examine such absence of light discover their beauty"

Hint:
• Use the message in the example as a test case. Store it in a variable called text.
• You will need to convert the message into small case letters, and remove punctuation marks.
• Your final output must be similar to the output in the example above.

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".

Reference no: EM132366759

Questions Cloud

Post your evaluation of significance of your research topic : Post your evaluation of the significance of your research topic and problem statement with regard to Quality Indicators 2 and 3. Explain whether your topic.
Is nancys asthma being managed properly : What is the value in performing this spirometry on Nancy when she already has a known diagnosis of asthma? Is Nancy’s asthma being managed properly?
How the process impacts the nursing home industry : Writer visually depicts how the process impacts the nursing home industry. Please be sure to review the various Academic Tools to assist you with meeting APA.
Write a evaluation of the video : Last week and this week, we've read about research, source evaluation, and documentation. For this week's assignment, write a 2-3 page, MLA-formatted.
Finds out if a given word can be read both ways : HS1031 - Introduction to Programming - Assess student’s ability to develop algorithmic solutions to programming problems using Python language.
Draw a plot of the probability density function : Draw a plot of the probability density function (pdf) for the number of sequencing errors on the genome. Label the graph with your answers from
West indies yacht club effective leadership : Pick 2 leaders from the case study and analyse their leadership style in your answer to the question.
Do you think that the local staff are being motivated : Do you think that the local staff are being motivated effectively? What are the main issues regarding motivation in the case?
Do you think the laws are clear and well written : Post a comprehensive response to the following: Do you think the laws are clear and well written? Support your stance with examples.

Reviews

len2366759

9/6/2019 12:00:30 AM

Question Marking criteria Marks Question 1 Appropriate commenting 2 Sound logic 2 Code running successfully 2 Total 6 Question 2 Appropriate commenting 2 Sound logic 2 Code running successfully 2 Total 6 Question 3 Appropriate commenting 2 Sound logic 3 Code running successfully 3 Total 8 Total Marks 20

len2366759

9/6/2019 12:00:22 AM

• Your code must be written in Python 3. You get no marks if the code is written in Python 2 or any other language. • All work must be submitted to Blackboard by the due date (Monday) • You are encouraged to avoid last minute submissions so that you do not run into technical difficulties. • You are allowed up to three attempts. All attempts must take place prior to assignment deadline. • Please note that the Self-check Safeassign link has been removed from Blackboard. You can still check your work for plagiarism by directly submitting your assignment. If the score for plagiarism is high, you are welcome to resubmit which will count as a second/third attempt. • Please note that plagiarism is treated seriously. All those caught plagiarising will get zero and get their names added to an institutional register. Remember

len2366759

9/6/2019 12:00:15 AM

• There are three questions in this assignment which require you to write and submit three Python scripts. Please save each script in two different formats: .py and .txt prior to submission. For example, for the first question you need to submit checkWord.py and checkWord.txt. • Combine all .py and .txt files into one zip or rar file (6 files in total). Finally, upload your compressed file (zip or rar) to Black Board and proceed with submission. • Code must be appropriately commented. Make sure to add comments at each segment of your code to explain what it does. You may lose grades if you do not add comments. You may lose grades if you do not add comments. • Make sure that your code runs successfully for all possible entries. Hint: test your code against the examples given in the question (if any). • Try to approach the solution with the least number of steps. Your code must be clear, logical, and easy to understand.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd