1 $ cat test.txt 2 Hello, how are you? 3 $ python3 piglatin.py 4 Enter English filename >>> test.txt 5 Enter filename to write to >>> test_piglatin.txt 6 Done. 7 $ cat test_piglatin.txt selloHay owhay areway ouyay Exercise 5.2 (piglatin.py). Write a program that translates a file from English to pig latin. The rules for pig latin are as follows: For a word that begins with consonants, the initial consonant or consonant cluster is moved to the end of the word and "ay" is added as a suffix: "happy" → "appyhay" "glove" → "overlay" For words that begin with vowels, you add "way" to the end of the word: "eggway" "inbox" "inboxway" For your program, you must write a function that takes in one individual word and returns the translation to pig latin. Write another function that takes a string, which may be sentences (may contain the characters "a-zA-Z.-;!?0" and space), and returns the translation of the sentence to pig latin. Strip out any punctuation. For example, "Hello, how are you?" would translate into "elloHay owhay areway ouyay". The user must be able to specify the filename for the file to be translated and the filename that the program should write to. For example:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
1 $ cat test.txt
2 Hello, how are you?
3 $ python3 piglatin.py
4 Enter English filename >>> test.txt
5 Enter filename to write to >>> test_piglatin.txt
6 Done.
7 $ cat test_piglatin.txt
selloHay owhay areway ouyay
Transcribed Image Text:1 $ cat test.txt 2 Hello, how are you? 3 $ python3 piglatin.py 4 Enter English filename >>> test.txt 5 Enter filename to write to >>> test_piglatin.txt 6 Done. 7 $ cat test_piglatin.txt selloHay owhay areway ouyay
Exercise 5.2 (piglatin.py).
Write a program that translates a file from English to pig latin. The rules for pig latin are as
follows:
For a word that begins with consonants, the initial consonant or consonant cluster is moved to
the end of the word and "ay" is added as a suffix:
"happy" → "appyhay"
"glove" → "overlay"
For words that begin with vowels, you add "way" to the end of the word:
"eggway"
"inbox" "inboxway"
For your program, you must write a function that takes in one individual word and returns the
translation to pig latin. Write another function that takes a string, which may be sentences (may
contain the characters "a-zA-Z.-;!?0" and space), and returns the translation of the sentence to
pig latin. Strip out any punctuation. For example, "Hello, how are you?" would translate into
"elloHay owhay areway ouyay".
The user must be able to specify the filename for the file to be translated and the filename that
the program should write to. For example:
Transcribed Image Text:Exercise 5.2 (piglatin.py). Write a program that translates a file from English to pig latin. The rules for pig latin are as follows: For a word that begins with consonants, the initial consonant or consonant cluster is moved to the end of the word and "ay" is added as a suffix: "happy" → "appyhay" "glove" → "overlay" For words that begin with vowels, you add "way" to the end of the word: "eggway" "inbox" "inboxway" For your program, you must write a function that takes in one individual word and returns the translation to pig latin. Write another function that takes a string, which may be sentences (may contain the characters "a-zA-Z.-;!?0" and space), and returns the translation of the sentence to pig latin. Strip out any punctuation. For example, "Hello, how are you?" would translate into "elloHay owhay areway ouyay". The user must be able to specify the filename for the file to be translated and the filename that the program should write to. For example:
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education