1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aalyn [17]
2 years ago
15

Def pig_latin(word): """ ------------------------------------------------------- Converts a word to Pig Latin. The conversion is

: - if a word begins with a vowel, add "way" to the end of the word. - if the word begins with consonants, move the leading consonants to the end of the word and add "ay" to the end of that. "y" is treated as a consonant if it is the first character in the word, and as a vowel for anywhere else in the word. Preserve the case of the word - i.E. If the first character of word is upper-case, then the new first character should also be upper case. Use: pl = pig_latin(word)
Computers and Technology
1 answer:
Virty [35]2 years ago
5 0

def pig_latin(word):

   if word[0].lower() in 'aeiou':

       word = word + 'way'

   else:

       t=''

       for x in range(len(word)):

           if word[x].lower() in 'aeiou':

               break

           if word[x].lower() == 'y' and x>0:

               break

           else:

               t+=word[x].lower()

       if word[0].isupper():

           word = word[len(t):]+word[:len(t)].lower()+'ay'

           word = word.title()

       else:

           word = word[len(t):]+word[:len(t)].lower()+'ay'

   return word

word = 'test'

pl = pig_latin(word)

print(pl)

I wrote my code in python 3.8. I hope this helps.

You might be interested in
When you purchase donuts, they come in boxes of 12, so 24 donuts take 2 boxes. All donuts need to be in a box, so if you buy 13
Dima020 [189]

Answer:

d) int numberOfBoxes = (numberOfDonuts + 11) / 12

Explanation:

Hope this helps

4 0
2 years ago
Csc105 final graded project
Tatiana [17]
What is this supposed to be?
5 0
3 years ago
How do computers perform complicated tasks built from simple instructions?
wlad13 [49]
They use and perform a set of actions and programs that build on each other.
8 0
3 years ago
To join two or more objects to make a larger whole is to _____________ them.
Masja [62]
C. Integrate is the answer PLZ MARK AS BRAINLIEST
6 0
3 years ago
Read 2 more answers
Define operating system?explain the types of operating system on the basis of use.​
GalinKa [24]

Answer:

An operating system is a software that helps the any computers basic needs or functions.  For example, the windows on a computer is a operating system.

Explanation:

4 0
2 years ago
Other questions:
  • Given the following code segment, what is output after "result = "? int x = 1, y = 1, z = 1; y = y + z; x = x + y; cout <<
    7·1 answer
  • Your friend sees an error message during Windows startup about a corrupted bootmgr file. He has another computer with a matching
    12·1 answer
  • A senior center would like to add a new computer to their library so that members can check their email and read book reviews
    11·2 answers
  • (BRAINLIEST QUESTION) What are some challenges that will need to be overcome in order for the Internet of Vehicles to become a r
    13·1 answer
  • Briefly summarize two examples of cybercrime stories.<br> quick pleaseeee
    10·1 answer
  • What are the first letters of each of the 3 main colors in javaScript? (seperate with commas)
    9·1 answer
  • Shane is working on a new project for the sales department. The company wants a way to allow the sales force to print orders at
    5·1 answer
  • RTOS stands for ______ Time Operating System.
    11·1 answer
  • A laptop can be kept on palm to work. [true/false) ​
    5·1 answer
  • Phân tích 5 phương hướng nhiệm vụ phát triển nông -lâm -ngư nghiệp ở nước ta hiện nay
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!