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
Novosadov [1.4K]
3 years ago
13

Write a function to_pig_latin that converts a word into pig latin, by: Removing the first character from the start of the string

, Adding the first character to the end of the string, Adding "ay" to the end of the string. So, for example, this function converts "hello"to "ellohay". Call the function twice to demonstrate the behavior. There is a worked example for this kind of problem.
Computers and Technology
1 answer:
S_A_V [24]3 years ago
8 0

Answer:

def to_pig_latin(word):

   new_word = word[1:] + word[0] + "ay"

   return new_word

print(to_pig_latin("hello"))

print(to_pig_latin("latin"))

Explanation:

Create a function called to_pig_latin that takes one parameter, word

Inside the function, create a new_word variable and set it to the characters that are between the second character and the last character (both included) of the word (use slicing) + first character of the word + "ay". Then, return the new_word.

Call the to_pig_latin function twice, first pass the "hello" as parameter, and then pass the "latin" as parameter

You might be interested in
c724 wgu True or false. A storage device consists of all the components that work together to process data into useful informati
Law Incorporation [45]

Answer:

False

Explanation:

A output device consists of all the components that work together to process data into useful information

8 0
3 years ago
What two pieces of information would you need in order to measure the masses of stars in an eclipsing binary system?
Nostrana [21]

Answer:

the time between eclipses and the average distance between the stars.

Explanation:

8 0
3 years ago
You found an image on the Creative Commons that you would like to use. How do you give credit to the author? *
Archy [21]
You need to write the author’s name
7 0
3 years ago
Read 2 more answers
How do you hack someone's wifi. (Hacker needed)​
Flauer [41]

Answer:

Ask God he knows all

Explanation:

3 0
3 years ago
Read 2 more answers
Write a full class definition for a class named Averager, and containing the following members:______An data member named sum of
alina1380 [7]

Answer:

  1. public class Averager {
  2.    private int sum;
  3.    private int count;
  4.    public Averager(int sum, int count) {
  5.        this.sum = 0;
  6.        this.count = 0;
  7.    }
  8.    public int getSum(){
  9.        return sum;
  10.    }
  11.    public void add( int num){
  12.        this.sum+=num;
  13.        this.count++;
  14.    }
  15.    public int getCount(){
  16.        return this.count;
  17.    }
  18.    public double getAverage(){
  19.        double ave = (int)this.sum/this.count;
  20.        return  ave;
  21.    }
  22. }

Explanation:

  • Lines 1-3 contains the class declaration and the member (data fields)
  • Lines 4-7 is the constructor that initializes the fields to 0
  • Lines 8-10 is the method that returns the value of sum getSum()
  • lines 11-14 iss the method add() that adds a number to the member field sum and increases count by 1
  • lines 15 - 17 is the method that returns total count getCount()
  • Lines 18-21 is the method getAverage() That computes the average and returns a double representing the average values

6 0
4 years ago
Read 2 more answers
Other questions:
  • What is the difference between EDX and the OCW?
    14·1 answer
  • When you use the Bing Image Search for online pictures, you will be searching the Internet for pictures that have been filtered
    9·2 answers
  • What does the binary odometer show about representing large numbers?
    8·1 answer
  • The master production schedule for Product A shows a need for 30 units, and Product B shows a need of 25 units. To manufacture a
    12·1 answer
  • Give an efficient algorithm to find all keys in a min heap that are smaller than a provided valueX. The provided valuedoes notha
    12·1 answer
  • Fill in the blanks : To store 3 character a computer occupies...................bytes memory space​
    8·2 answers
  • Importance of spread sheets​
    7·1 answer
  • Difference between hardcopy and hardware​
    6·1 answer
  • Complete the function to return the factorial of the parameter using recursion.
    13·1 answer
  • Choose the term that best matches the definition.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!