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
g Design a Boolean function called isPrime, that accepts an integer as an argument and returns True if the argument is a prime n
professor190 [17]

Answer:

#include <bits/stdc++.h>

using namespace std;

bool isPrime(int n)

{

   for(int j=2;j<=n-1;j++)  //loop to check prime..

   {

       if(n%j==0)

       return false;

   }

   return true;

}

int main(){

   int n;

   cout<<"Enter the integer"<<endl;//taking input..

   cin>>n;

   if(isPrime(n))//printing the message.

   {

       cout<<"The number you have entered is prime"<<endl;

   }

   else

   {

       cout<<"The number is not prime"<<endl;

   }

return 0;

}

Output:-

Enter the integer

13

The number you have entered is prime

Explanation:

The above written program is in C++.I have created a function called isPrime with an argument n.I have used a for loop to check if the number is prime or not.In the main function I have called the function isPrime for checking the number is prime or not.

4 0
3 years ago
Which operating system might cause the desktop background to change unexpectedly?
Hunter-Best [27]
I used computers for 3 years now and i think its B
4 0
2 years ago
Suppose an array of country codes and country names is created with a statement like this: $country_codes = array('DEU' =&gt; 'G
valentina_108 [34]

Answer:

Following are the code in the PHP Programming Language:

<u>foreach ($country_codes as $code => $name) { </u>

Explanation:

The following option is true because the Foreach statement only works on the objects and array and this statement is good for accessing the key and value pairs from the array.

So, that's why to print following associative array through echo statement we use the Foreach loop statement with following right condition.

<u>syntax</u>:

foreach (array as value)

{

  code or body to execute;

}

8 0
3 years ago
A data visualization tool that updates in real time and gives multiple outputs is called
strojnjashka [21]

Answer:

A data dashboard

Explanation:

3 0
2 years ago
Data with values that change continuously or smoothly over time is known as:
Alexeev081 [22]

Answer:

A.  \:  \boxed{analog  \: data}

5 0
3 years ago
Read 2 more answers
Other questions:
  • Carolyn owns a small business that designs air conditioning units for large buildings. A construction company that's building an
    13·1 answer
  • Information is a valuable asset and not everyone in the world can be trusted with it. Therefore, we need to protect our valuable
    10·1 answer
  • Componets of computer
    5·1 answer
  • python A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun
    15·2 answers
  • What kind of value should an employee possess when employees are expected to be responsible and fair?
    7·1 answer
  • Please list ten things that you have learned an Excel Spreadsheet can do.
    7·1 answer
  • About how long did it take to photograph Daguerre's photograph of the street?
    7·1 answer
  • Which relation is created with the primary key associated with the relationship or associative entity, plus any non-key attribut
    6·1 answer
  • PLEASE HURRY 30 POINTS
    15·2 answers
  • The memory capacity in bits for performing the operation y = f (x) using the table lookup method, where x is an 8-bit number and
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!