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
URGENT!!! While using her digital camera to photograph her new couch in her living room, Amy uses the white balance setting that
nirvana33 [79]

Answer:  A. Fluorescent

Explanation:    Bc I'm always right :)

5 0
3 years ago
Read 2 more answers
Fungi, plants, algae, mold, and humans are all located in the
Strike441 [17]

they are all eukaryotic cells

5 0
4 years ago
Read 2 more answers
You can press the ____ keys to open the Format Cells dialog box.
Kobotan [32]
You can press the 1 + Control(CTRL).
4 0
3 years ago
Define a function below called average_num_in_file. The function takes one argument: the name of a file full of numbers. Complet
Nookie1986 [14]

Answer:

  1. def average_num_in_file(fileName):
  2.    with open(fileName) as file:
  3.        rows = file.readlines()
  4.        sum = 0
  5.        count = 0
  6.        for x in rows:
  7.            sum += float(x)  
  8.            count += 1
  9.        average = sum / count  
  10.    return average  
  11. print(average_num_in_file("cans.txt"))

Explanation:

The solution code is written in Python 3.

Firstly create a function that take one parameter, fileName (Line 1).

Open the file stream and use readlines method to read the data from the file (Line 2-3). Create variable sum and count to tract the total of the number from text files and number of data from the file (Line 5-6). Use a for loop to loop over each row of the read data and add the current value of each row to sum and increment the count by one (Line 7-9).

After the loop, calculate the average (Line 11) and return the result (Line 12).

At last, we can test the function by passing the cans.txt as argument (Line 14).

7 0
4 years ago
The animation industry is solely reliant on 3-D modeling and 3-D virtualization to create the animated movies in the cinemas.
loris [4]
False it is false people also hand draw stuff
7 0
4 years ago
Other questions:
  • A group of eight bits is called a _______. a. numeric data b. byte c. megabit d. binary
    5·1 answer
  • What is the Explicit Dependencies Principle? Explain why explicit dependencies are better than implicit dependencies.
    6·1 answer
  • Tel me free english learning website?
    5·1 answer
  • Jed is the database administrator for a mid-sized computer component manufacturer. He is responsible for validating the data mod
    12·1 answer
  • marco wants to create a heading that is bold and italic to make it really stand out on his webpage. he's typed in the code
    12·2 answers
  • Suppose Alice and Bob are sending packets to each other over a computer network. SupposeTrudy positions herself in the network s
    11·1 answer
  • In 3-5 sentences describe whether or not files should be deleted from your computer explain your answer
    12·1 answer
  • Question # 4
    13·2 answers
  • Date... Page No I write program to the check whether the supplied number is prime or not using a function procedor​
    13·1 answer
  • What level of access can a subapplication owner provide to another egrants user in the same organization who has been authorized
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!