Question
haveing a hard time figuring out please help
thank you
Problem program.py > Entschuldigung, können Sie Englisch sprechen? During your holiday in Germany, you decide its time to wri
0 0
Add a comment Improve this question Transcribed image text
Answer #1

PROGRAM

#function definition
def fix_yz(s):
#Taking each character by character from the string
for char in s:
#ord()function converts a character to an integer (ASCII value)
#chr() function converts back to integer
if char==chr(ord('z')):
newchar=chr(ord('z')-1)
#replace function replaces z with y
s=s.replace(char,newchar)
if char==chr(ord('Z')):
newchar=chr(ord('Z')-1)
#replace function replaces Z with Y
s=s.replace(char,newchar)
if char==chr(ord('y')):
char=chr(ord('y')+1)
#replace function replaces y with z
s=s.replace(char,newchar)
if char==chr(ord('Y')):
char=chr(ord('Y')+1)
#replace function replaces Z with Y
s=s.replace(char,newchar)
return(s)
#main program
#function call
print(fix_yz("What did zou saz?"))

PYTHON CODE IN IDLE for better understanding of spacing and indentation.

File Edit Format Run Options Window Help #function definition def fix yz (s): #Taking each character by character from the stOutput Screen

What did you say? >>> |

Add a comment
Answer #2
def fix_yz(s):
  s=s.replace('z','$$IfYoUsEeThIsItIssAbbUUUuug$$')
  s=s.replace('Z','$$IfYoUsEeThIsItIssAbbUUUuuug$$')
  s=s.replace('y','z')
  s=s.replace('Y','Z')
  s=s.replace('$$IfZoUsEeThIsItIssAbbUUUuug$$','y')
  s=s.replace('$$IfZoUsEeThIsItIssAbbUUUuuug$$', 'Y')
  return(s)


source: grok bug
answered by: declan
Add a comment
Know the answer?
Add Answer to:
haveing a hard time figuring out please help thank you Problem program.py > Entschuldigung, können Sie...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Having a hard time figuring out this problem!! Please help, step-by-step and interpret. Thank you!! Score:...

    Having a hard time figuring out this problem!! Please help, step-by-step and interpret. Thank you!! Score: 0 of 1 pt 8 of 13( completel Score: 53.85%, 7 of 13 pts 0.5.149 I Questen Hop * Obrain terequired confidence itervel Interpret your resuh The ท companying dete prowde the weights, en pounds of 17 rerece wormen bele" and rer mom ng the fomily therapy teatment menpy treatment for morem en o58 Find ฮ 90% comdence interval nr the w"g" gan tat...

  • Java: Please help with my Tester. I'm having a hard time figuring out my error. Thank...

    Java: Please help with my Tester. I'm having a hard time figuring out my error. Thank you. What the tester requires: The AccountTester This class should consists of a main method that tests all the methods in each class, either directly by calling the method from the Tester or indirectly by having another method call a method. User and Bot information will be read from a file. A sample file is provided. Use this file format to aid in grading....

  • Help with programming in C++ Phase 1 is complete, please help with phase 2. Thank you....

    Help with programming in C++ Phase 1 is complete, please help with phase 2. Thank you. Phase 1 You must design 3 algorithms, and provide both a flow chart and pseudo code for the algorithms.    Algorithm descriptions: Given an integer parameter named current_number and two constant global variables: const int MIN_NUMBER = 1; const int MAX_NUMBER = 8; Create an algorithm named forward, that will advance ONE value through a sequence of numbers 1, 2, 3 ... MAX_NUMBER. In...

  • This is my assignment in Python. Please help me thank you Design type 1: # Creating an object of ...

    This is my assignment in Python. Please help me thank you Design type 1: # Creating an object of the class "Burger" theOrder = Burger() # calling the main method theOrder.main() # And the class is like: class Burger: # You may need to have a constructor def __init__(self): self._orderDict = {} self._priceBeforeTax = 0 self._priceAfterTax = 0 # you may have the tax rate also as an instance variable. But as I mentioned, you can use your # own...

  • please give me the answer to all of them thank you 8. -0 points My Notes...

    please give me the answer to all of them thank you 8. -0 points My Notes Ask Your Teacher A particle with a mass of 0.340 kg is attached to a horizontal spring with a force constant of 3.0ō N m At the moment t moving to the left. (Assume that the positive direction is to the right.) 0 the partice has s maximum speed of 75ms and s (a) Determine the particle's equation of motion, specifying its position as...

  • ANY HELP PLEASE. PLEASE READ THE WHOLE INSTRUCTION THANK YOU Write a program GS.java that will...

    ANY HELP PLEASE. PLEASE READ THE WHOLE INSTRUCTION THANK YOU Write a program GS.java that will be responsible for reading in the names and grades for a group of students, then reporting some statistics about those grades. The statistics to be gathered are the number of scores entered, the highest score and the name(s) of the student(s) who earned that score, the lowest score and the name(s) of the student(s) who earned that score, and the average score for the...

  • please give me answers to all the questions and i would really appreciate that thank you...

    please give me answers to all the questions and i would really appreciate that thank you 6. -0 points My Notes O Ask Your Teache A 10.1 kg object oscillates at the end of a vertical spring that has a spring constant of 2.20 x 104 N/m. The effect of air resistance is represented by the damping coefficient b = 3.00 N-s/m (a) Calculate the frequency of the dampened oscillation. H2 (b) By what percentage does the amplitude of the...

  • PLEASE HELP!! Clear steps for each part would be much appreciated. thank you! It's not just money that multiplies with time... Suppose the number of bacteria on the surface of a phone screen dou...

    PLEASE HELP!! Clear steps for each part would be much appreciated. thank you! It's not just money that multiplies with time... Suppose the number of bacteria on the surface of a phone screen doubles every 3 hours. 4. Write a function for the population, p, of bacteria as a function of n where n is the number of 3-hour periods since the bacteria first start multiplying. Call the initial population po a. b. How much will the population grow over...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

  • Please help me write in C++ language for Xcode. Thank you. In this lab you are...

    Please help me write in C++ language for Xcode. Thank you. In this lab you are going to write a time card processor program. Your program will read in a file called salary.txt. This file will include a department name at the top and then a list of names (string) with a set of hours following them. The file I test with could have a different number of employees and a different number of hours. There can be more than...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT