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
Without this step of the problem solving process you might solve the wrong problem, not know where to start, or not know when yo
STatiana [176]
Prepare should be the answer
7 0
3 years ago
Discuss Hardware is useless without software?​
Alexus [3.1K]

Explanation:

Hardware is useless without software because the machinery will not and cannot do anything without programming to tell it what to do. Without an operating system, the computer can't do anything. Without other software, like Microsoft Office, you can't type anything or listen to music or watch video or anything

7 0
3 years ago
What is the best website to get a iphone
sveticcg [70]
Generally I'd recommend not buying one online, tends to be cheaper from a shop - and better used, although their are some risks with 2nd hand devices, I think the big price cut it worth it. 

If you did want to buy online, maybe Amazon or Ebay?
7 0
4 years ago
Read 2 more answers
An internet address that ends in .com is operated by
ollegr [7]
.com means company, so it is ran by a company.

4 0
3 years ago
Read 2 more answers
Describa las etapas del arranque de viruta
blondinia [14]

Answer:

Las virutas son partículas que se eliminan mecánicamente de una pieza de trabajo mecanizada. En el contexto de la tecnología de fabricación, especialmente el mecanizado, el término se refiere principalmente a virutas de metal; En principio, sin embargo, las virutas se crean en todo tipo de mecanizado de cuerpos sólidos. Las astillas de madera son el resultado de la carpintería. Cuando se mecanizan plásticos, se crean virutas, así como cuando se mecanizan materiales minerales, cristalinos o amorfos como el vidrio, que a menudo se realiza mediante esmerilado.

7 0
3 years ago
Other questions:
  • Which of the following statements is true of ASCII code?
    12·1 answer
  • What procedures are involved in saving a file for the first time?
    10·2 answers
  • Which statement is true regarding bitmap images?
    6·2 answers
  • First write a method to calculate the greatest common divisor (GCD) of two positive integers using Euclid’s algorithm (also know
    10·1 answer
  • 7.5 Code practice Plz answer ASAP
    15·1 answer
  • Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a/b, in which a and b a
    11·1 answer
  • This function returns the length of a string:
    13·1 answer
  • What variation pairs a new employee with an employee who has been with the company for 20 years?
    6·2 answers
  • Data will zip through a 5G network much faster than through a 4G network because of the 10-fold difference in _____.
    7·1 answer
  • Given the following class, Book, Write code for the following:
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!