Question: Please do not change any of the code provided I get marked off for that. Here is a copy of my code from my homework

Please do not change any of the code provided I get marked off for that.

Please do not change any of the code provided I get markedoff for that. Here is a copy of my code from myhomework before so you do not have to type it all out:## Paste your pig latin function here, if you didn't follow the

Here is a copy of my code from my homework before so you do not have to type it all out:

## Paste your pig latin function here, if you didn't follow the specs on the homework you are in for a rough time

from string import ascii_lowercase

from string import ascii_uppercase

from string import digits

#method to convert a single word to pig latin

def english_to_igpay_atinlay(word):

outputyay=''

#a boolean flag variable to denote if first letter was capitalized

capitalized=False

if len(word)==0:

#if empty, return empty string

return ''

#checking if first letter is upper case

if word[0].isupper():

#first letter of result will be capitalized

capitalized=True

#converting word to lower case

word=word.lower()

#checking if word is a vowel

if word[0] in ['a','e','i','o','u']:

#appending yay and returning

outputyay=word+'yay'

return outputyay

#looping until a vowel is found, or all characters have been iterated

temp=''

while len(word)>0:

#checking if word is a vowel

if word[0] in ['a','e','i','o','u']:

#end of loop

break

elif word[0] in ascii_lowercase:

#adding character to temp

temp+=word[0]

#removing first letter from word

word=word[1:]

else:

return '' #special character or digit found

#appending temp to current state of word and appending 'ay'

outputyay=word+temp+'ay'

#capitalizing first letter if it was capitalized before

if capitalized:

outputyay=outputyay[0].upper()+outputyay[1:]

return outputyay

def main():

#creating a string

string="We are going to build a function that translates words into pig latin"

#looping through each word in string

for word in string.split():

#converting to pig latin and displaying on the same line

print(english_to_igpay_atinlay(word),end=' ')

print()#line break

main()

I Need to turn this into pig latin: Declaration of Independence [Adopted in Congress 4 July 1776] The Unanimous Declaration of the Thirteen United States of America When, in the course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the laws of nature and of nature's God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation. We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable rights, that among these are life, liberty and the pursuit of happiness. That to secure these rights, governments are instituted among men, deriving their just powers from the consent of the governed. That whenever any form of government becomes destructive of these ends, it is the right of the people to alter or to abolish it, and to institute new government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their safety and happiness. Prudence, indeed, will dictate that governments long established should not be changed for light and transient causes; and accordingly all experience hath shown that mankind are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, pursuing invariably the same object evinces a design to reduce them under absolute despotism, it is their right, it is their duty, to throw off such government, and to provide new guards for their future security. -- Such has been the patient sufferance of these colonies; and such is now the necessity which constrains them to alter their former systems of government. The history of the present King of Great Britain is a history of repeated injuries and usurpations, all having in direct object the establishment of an absolute tyranny over these states. To prove this, let facts be submitted to a candid world. He has refused his assent to laws, the most wholesome and necessary for the public good. He has forbidden his governors to pass laws of immediate and pressing importance, unless suspended in their operation till his assent should be obtained; and when so suspended, he has utterly neglected to attend to them. He has refused to pass other laws for the accommodation of large districts of people, unless those people would relinquish the right of representation in the legislature, a right inestimable to them and formidable to tyrants only. He has called together legislative bodies at places unusual, uncomfortable, and distant from the depository of their public records, for the sole purpose of fatiguing them into compliance with his measures. He has dissolved representative houses repeatedly, for opposing with manly firmness his invasions on the rights of the people. He has refused for a long time, after such dissolutions, to cause others to be elected; whereby the legislative powers, incapable of annihilation, have returned to the people at large for their exercise; the state remaining in the meantime exposed to all the dangers of invasion from without, and convulsions within. He has endeavored to prevent the population of these states; for that purpose obstructing the laws for naturalization of foreigners; refusing to pass others to encourage their migration hither, and raising the conditions of new appropriations of lands. He has obstructed the administration of justice, by refusing his assent to laws for establishing judiciary powers. He has made judges dependent on his will alone, for the tenure of their offices, and the amount and payment of their salaries. He has erected a multitude of new offices, and sent hither swarms of officers to harass our people, and eat out their substance. He has kept among us, in times of peace, standing armies without the consent of our legislature. He has affected to render the military independent of and superior to civil power. He has combined with others to subject us to a jurisdiction foreign to our constitution, and unacknowledged by our laws; giving his assent to their acts of pretended legislation: For quartering large bodies of armed troops among us: For protecting them, by mock trial, from punishment for any murders which they should commit on the inhabitants of these states: For cutting off our trade with all parts of the world: For imposing taxes on us without our consent: For depriving us in many cases, of the benefits of trial by jury: For transporting us beyond seas to be tried for pretended offenses: For abolishing the free system of English laws in a neighboring province, establishing therein an arbitrary government, and enlarging its boundaries so as to render it at once an example and fit instrument for introducing the same absolute rule in these colonies: For taking away our charters, abolishing our most valuable laws, and altering fundamentally the forms of our governments: For suspending our own legislatures, and declaring themselves invested with power to legislate for us in all cases whatsoever. He has abdicated government here, by declaring us out of his protection and waging war against us. He has plundered our seas, ravaged our coasts, burned our towns, and destroyed the lives of our people. He is at this time transporting large armies of foreign mercenaries to complete the works of death, desolation and tyranny, already begun with circumstances of cruelty and perfidy scarcely paralleled in the most barbarous ages, and totally unworthy of the head of a civilized nation. He has constrained our fellow citizens taken captive on the high seas to bear arms against their country, to become the executioners of their friends and brethren, or to fall themselves by their hands. He has excited domestic insurrections amongst us, and has endeavored to bring on the inhabitants of our frontiers, the merciless Indian savages, whose known rule of warfare, is undistinguished destruction of all ages, sexes and conditions. In every stage of these oppressions we have petitioned for redress in the most humble terms: our repeated petitions have been answered only by repeated injury. A prince, whose character is thus marked by every act which may define a tyrant, is unfit to be the ruler of a free people. Nor have we been wanting in attention to our British brethren. We have warned them from time to time of attempts by their legislature to extend an unwarrantable jurisdiction over us. We have reminded them of the circumstances of our emigration and settlement here. We have appealed to their native justice and magnanimity, and we have conjured them by the ties of our common kindred to disavow these usurpations, which, would inevitably interrupt our connections and correspondence. They too have been deaf to the voice of justice and of consanguinity. We must, therefore, acquiesce in the necessity, which denounces our separation, and hold them, as we hold the rest of mankind, enemies in war, in peace friends. We, therefore, the representatives of the United States of America, in General Congress, assembled, appealing to the Supreme Judge of the world for the rectitude of our intentions, do, in the name, and by the authority of the good people of these colonies, solemnly publish and declare, that these united colonies are, and of right ought to be free and independent states; that they are absolved from all allegiance to the British Crown, and that all political connection between them and the state of Great Britain, is and ought to be totally dissolved; and that as free and independent states, they have full power to levey war, conclude peace, contract alliances, establish commerce, and to do all other acts and things which independent states may of right do. And for the support of this declaration, with a firm reliance on the protection of Divine Providence, we mutually pledge to each other our lives, our fortunes and our sacred honor.

CS 497 Introduction to Python Programming Instructions 0. Remember to comment. If your code fails to perform the task at hand but your comments are describing proper code execution I can award a substanial amount of points for logical errors in your program. Think of comments as the equivalent of showing your work in a math class. 1. Read all instructions carefully, ask questions if anything is confusing 2. Fill in the code/text blocks to answer each question. 3. Do not change any of the existing code provided. The code is specifically there to help you! 4. Run the entire notebook before submitting it on Sakai to make sure that the code actually runs without errors 5. Important Any question for which your code fails to run will receive 0 points 6. Have fun! 7. DO NOT USE ANY PACKAGES, other than the ones I have imported. Part of learning is to struggle through the "hard way" before getting to do things the easy way. Any packagesI have importe ae fair game and you may use any functions unless otherwise specified. If I've imported them after a function, I've deliberately made it so you cannot retroactively use them in an earlier problem. 8. If I've used return(None) for a function, you may definitely change the return type. It's just a placeholder 9. While you may discuss the concepts of the problems with your peers your code will need to be yours and yours alone 10. Replace CS497 with your BUID (ie if I was turning in this assignment my file would be called dbrennan-lab#5) 11. Do not zip your lab file with the tt, i do no want your generated txt (I will make it myself!) This lab is all or nothing, you'll get either 100 points or 0 points. If you followed directions on the pig latin translator, you'll be fine In [26]: H ## To do, create a file in read only mode and read the declaration of indepence tn (all the lines) ## Make sure these lines are saved as a list called list to translate ## Make sure the txt is in the same directory as the notebook list to translate [ ## Your code here in [ ]: In [27]: H ## Paste your pig Latin function here, if you didn't follow the specs on the homework you are in for a rough time from string import ascii_lowercase from string import ascii uppercase from string import digits #method to convert a single word to pig Latin def english_to igpay_atinlay(word): outputyay #a boolean flag variable to denote if first Letter was capitalized capitalized-False if len (word)-0: #if empty, return empty string return #checking if first letter is upper case if word[0].isupper): #first Letter of result will be capitalized capitalized-True #converting word to lower case word-word.lower) #checking if word s a vowel if word0] in 'a', 'e''i' o'u if word [0] in ['a','e','','o','u']; #appending yay and returning out putyay=word+' yay . return outputyay #Looping until a vowel s found, or all characters have been iterated temp- while len (word)>0: #checking if word is a vowel if word[9] in ['a', 'e','i','0','u']; #end of Loop break elif word[0] in ascii_lowercase: #adding character to temp temp+-word[] emoving first letter from word word-word[1:1 else: return .. #special character or digit found #appending temp to current state of word and appending 'ay' outputyay word+temp+ 'ay #capitalizing first letter if it was capitalized before if capitalized: outputyay-outputyay [0].upper)+outputyay[1:1 return outputyay def main): #creating a string string-"We are going to build a function that translates words into pig latin" #tooping through each word in string #Looping through each word in string for word in string.split): #con verting to pig latin and displaying on the same Line print(english_to igpay atinlay (word),end-') print()#line break main() In [28]: H ## DO NOT MODIFY THIS CODE CELL from string import ascii letters def word replacer(string): output string temp-word = "" ##We know we've "seen a word" when we find the first non-alpha character after finding some prior Letters for character in string: #If it's not alpha, we merely need to preserve it if character in ascii letters: temp word+-character else: #First find the pig Latin word #Next concatenate the output string with the pig Latin word and the non-alpha character that we saw #Finally reset the temp word pig latin word english to igpay atinlay(temp_word) output_string+-pig latin word+character temp-word "" return output string In [29]: H ## Make your output file here, we will write the translated text to a new file ## Loop over your list-to-translate calling word-replacer (you won't need to modify it at all) ## print each line of the list to your file ## remember to do something with the file after you are done (the word ends with "Lose") In [38]: H ##Ma ke your file here In [39]: ##Loop through your file here, write each line out in a loop In [40]: ##What do we do with files after we are done with them? Do this for BOTH files

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!