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]
3 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]3 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
Pressing the Ctrl+Home keys moves the insertion point to the
rewona [7]
I'm going to go with A
5 0
3 years ago
Is the weegy face real?or is it computer generated?
allsm [11]
Weegy face is known to be a computer generated program that was designed well by expert developers. It's a type of image that usually works whenever you use the Internet Explorer, and works most of the time on that browser.
3 0
3 years ago
pleeeease help!! I tried to turn on icloud photos to save storage and it’s been stuck at 1%. does anyone know why or how to fix
gtnhenbr [62]

Answer:

Explanation:

It just takes a very long time if you have too many videos or even very long ones. It took me 14 hours to download mine. You have to let it download though do not interrupt it! Very important!

3 0
3 years ago
WILL GIVE BRAINLIEST!!!!!!!
lisov135 [29]

Answer:

Ac

Explanation:

Ac maybe.Idk sorry.

8 0
3 years ago
What is the binary equivalent of the volume 3F?
kaheart [24]

Answer:

The binary equivalent of the volume 3F is

A. 00111111

Hope it will help. :)❤

6 0
3 years ago
Other questions:
  • For local travel addresses and street names should be
    14·1 answer
  • Which of these is an on-site metric for social media marketing?
    13·1 answer
  • GenXTech is a growing company that develops gaming applications for military simulations and commercial clients. As part of its
    9·1 answer
  • What type of network is the Internet? The Internet is an example of a_____network.
    12·1 answer
  • A(n) _____ measures the ability to juggle a variety of demands, as in a manager's job where the candidate is presented with simu
    8·1 answer
  • Insert a row above the selected row (in between row 1 and row 2).
    15·2 answers
  • When a signal travels across network medium, it signal loses strength the further it gets from the transmitting station, to the
    7·1 answer
  • How can photography allow us to view the world around us in different ways?
    5·2 answers
  • State the function of the <br> BIOS,​
    11·1 answer
  • What is the input for air cooler computer science​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!