Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

Problem 1(a): Pig Latin.

In "Pig Latin", English words are transformed according to the following rules:

If the word begins with one or more consonants, those consonants are moved to the end of the word, followed by "ay":

  • pig -> igpay
  • Latin -> Atinlay
  • trash -> ashtray

If the word begins with a vowel, it is followed by "yay":

  • apple -> appleyay
  • out -> outyay.

Note that more than one consonant may be moved to the end of the word. Note also that"y" functions as a consonant at the start of words. Note also that capitalization should be preserved after manipulating the word.

Write Python code that takes a word and converts it to Pig Latin. If the input consists of multiple words or contains punctuation, your code should print a suitable error message.

Problem 1(b): Test Suite.

Test your code on the following words, and be sure your output matches what is shown on the right hand side of each arrow. Print the results of each test. If your output does not match, then fix your code in 1(a).

* orange -> orangeyay

* yellow -> ellowyay

* Strip -> Ipstray

* quarter -> arterquay

* schmooze -> oozeschmay

* a -> ayay

* Pig Latin -> (should produce an error message)

* Ke$ha -> (should produce an error message)

Problem 2(a): Letter Frequencies.

The files encryptedA.txt and encryptedB.txt contain two different encrypted messages on similar topics. One message was originally in English and one was in Welsh.

Write Python code that reads a text file into memory and creates a dictionary object with a frequency count for each letter. For example, for encryptedA.txt, your output should contain the key:value pairs 'a': 78 and 'b': 31. Do not distinguish between uppercase and lowercase letters, and ignore punctuation. If a given letter does not appear in the text, there should be a key:value pair with value 0.

Use Python to determine which letter has the highest frequency in each text file, and print the result.

Problem 2(b): Formatting for R.

Write your dictionaries with frequency counts to .csv files, with one column for the key and one column for the frequency counted.

Python, Programming

  • Category:- Python
  • Reference No.:- M92205046

Have any Question?


Related Questions in Python

Tasksdemonstrate data scraping of a social network of

Tasks Demonstrate data scraping of a social network of choice. Develop technical documentation, including the development of the code & detailing the results. Provide a report on the findings, that includes research into ...

Question write a python program with a graphical user

Question: Write a python program with a graphical user interface that will allow a user to create a custom pizza which they wish to order. At minimum, the user should be able to choose the size of the pizza, the type of ...

Foundations of programming assignment - feduni bankingthis

Foundations of Programming Assignment - FedUni Banking This assignment will test your skills in designing and programming applications to specification. Assignment Overview - You are tasked with creating an application t ...

Below zero - ice cream storethe local ice-cream store needs

Below Zero - ice cream store The local ice-cream store needs a new ordering system to improve customer service by streamlining the ordering process. The manager of the store has found that many orders are incorrect and s ...

Environment setupthe first mini project will be based on

Environment Setup The first mini project will be based on Ladder Logic programming. We will be using Schneider Electric's IDE called SoMachine Basic to do the programming. The latest ver- sion of SoMachine Basic for Wind ...

Show times in tmus and seconds1 an associate grasps an oven

Show times in TMUs and seconds. 1. An associate grasps an oven door within reach and pulls it open 18 inches with the left hand (he does not relinquish control of the door). With a pan in the right hand, he carefully pos ...

Sieve of eratosthenes in pythonthe goal is to find all the

Sieve of Eratosthenes (in Python) The goal is to find all the prime numbers less than or equal to some natural number maxn. We have a list that tells us if any of the numbers 0..maxn are "marked". It can be an array of b ...

Part i the assignment filesone of the most important

Part I: The Assignment Files One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a ...

Question write a simple python program that takes use

Question: Write a simple python program that takes use inputs as non-zero digits and converts them into binary form. The response must be typed, single spaced, must be in times new roman font (size 12) and must follow th ...

The second task in this assignment is to create a python

The second task in this assignment is to create a Python program called pancakes.py that will determine the final order of a stack of pancakes after a series of flips.(PYTHON 3) Problem Task In this problem, your input w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As