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
Zanzabum
3 years ago
5

The y and z keys swapping position is messing with your touch typing. You decide to write out your email as if the keys were in

the correct position and then use Python to swap all ys and zs. Your task here is to write a function called fix_yz. This function takes a single argument which will be a string. Your function needs to return this string with all of the ys and zs swapped, and all of the Ys and Zs swapped. Here are some example calls to your function:
s = fix_yz('What did zou saz?')print(s)What did you say?s = fix_yz('Zour tip about the yoo was a great one!')print(s)Your tip about the zoo was a great one!s = fix_yz('We onlz have one week left')print(s)We only have one week left :(HintThe auto-marker is expecting you to submit only your fix_yz function definition. You should not include any calls to your function.

Engineering
1 answer:
Zarrin [17]3 years ago
4 0

Answer:

# the function fix_yz is defined

# it takes a string as parameter

def fix_yz(word):

   # new_word is to hold the new corrected string

   new_word = ""

   # loop through the string

   # and check for any instance of y or z.

   # if any instance is found, it is replaced accordingly

   for each_letter in word:

       if each_letter == 'z':

           new_word += 'y'

       elif each_letter == 'Z':

           new_word += 'Y'    

       elif each_letter == 'y':

           new_word += 'z'

       elif each_letter == 'Y':

           new_word += 'Z'        

       else:

           new_word += each_letter

   # the value of new string is returned

   return new_word        

Explanation:

The function is written in Python 3 and it is well commented. An image is attached showing the output of the given example.

The function take a string as input. It then loop through the string and check for any instance of 'y' or 'z'; if any instance is found it is swapped accordingly and then append to the new_word.

The value of bew_word is returned after the loop.

You might be interested in
Plssssssssssssss Alexi is writing a program which prompts users to enter their age. Which function should she use?
aleksandr82 [10.1K]

Answer:

int()

Explanation:

float() is using decimals, so that can't be it, like float(input( "how much does this cost?"))

print() is used to print something, not a user asking, like print("hello")

string() means like a whole, like string( I am good)

By elimination, int() is correct.

Hope this helps!

7 0
2 years ago
In a certain chemical plant, a closed tank contains ethyl alcohol to a depth of 71 ft. Air at a pressure of 17 psi fills the gap
Yuliya22 [10]

Answer:

the pressure at a closed valve attached to the tank 10 ft above its bottom is 37.88 psi

Explanation:

Given that;

depth 1 = 71 ft

depth 2 = 10 ft

pressure p = 17 psi = 2448 lb/ft²

depth h = 71 ft - 10 ft = 61 ft

we know that;

p = P_air + yh

where y is the specific weight of ethyl alcohol ( 49.3 lb/ft³ )

so we substitute;

p = 2448 + ( 49.3 × 61 )

= 2448 + 3007.3

= 5455.3 lb/ft³

= 37.88 psi

Therefore, the pressure at a closed valve attached to the tank 10 ft above its bottom is 37.88 psi

5 0
3 years ago
A plate and frame heat exchanger has 15 plates made of stainless steel that are 1 m tall. The plates are 1 mm thick and 0.6 m wi
hodyreva [135]

Answer:

14.506°C

Explanation:

Given data :

flow rate of water been cooled = 0.011 m^3/s

inlet temp = 30°C + 273 = 303 k

cooling medium temperature = 6°C  + 273 = 279 k

flow rate of cooling medium = 0.02 m^3/s

Determine the outlet temperature

we can determine the outlet temperature by applying the relation below

Heat gained by cooling medium = Heat lost by water

= ( Mcp ( To - 6 )  =  Mcp ( 30 - To )

since the properties of water and the cooling medium ( water ) is the same

= 0.02 ( To - 6 ) = 0.011 ( 30 - To )

= 1.82 ( To - 6 ) = 30 - To

hence To ( outlet temperature ) = 14.506°C

6 0
3 years ago
Who is the mystical body of Christ
Sergeu [11.5K]
If you're talking ab jesus christ , some religions believe it was god in human form and some believe it was gods son it all depends on the religion and how it's taught
8 0
3 years ago
Read 2 more answers
What are the conditions for sheet generator to build up its voltage?
MA_775_DIABLO [31]

Answer:

There are six conditions

1. Poles should contain some residual flux.

2. Field and armature winding must be correctly connected so that initial mmm adds residual flux.

3. Resistance of field winding must be less than critical resistance.

4. Speed of prime mover of generator must be above critical speed.

5. Generator must be on load.

6. Brushes must have proper contact with commutators.

Explanation:

3 0
3 years ago
Other questions:
  • Steam at 1 MPa, 300 C flows through a 30 cm diameter pipe with an average velocity of 10 m/s. The mass flow rate of this steam i
    13·1 answer
  • A 0.19-m3 rigid tank equipped with a pressure regulator contains steam at 2 MPa and 300°C. The steam in the tank is now heated.
    12·1 answer
  • Consider a drainage basin having 60% soil group A and 40% soil group B. Five years ago the land use pattern in the basin was ½ w
    12·1 answer
  • The technique of smoothing out joint compound on either side of a joint is known as which of the following
    14·1 answer
  • Why would Chris most likely conclude that he should seek help? A. He feels in control of his emotions even though people annoy h
    15·2 answers
  • Which statement concerning symbols used on plans is true?
    10·1 answer
  • Practice finding the volume of a sphere.
    10·2 answers
  • Two sites are being considered for wind power generation. On the first site, the wind blows steadily at 7 m/s for 3000 hours per
    5·1 answer
  • What does an engineer do? List as many types of engineers as you can.
    9·1 answer
  • Technician A says when the brakes are applied in a vacuum booster, the vacuum control valve is closed. Technician B says the vac
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!