Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python, pls follow all requirements thank you = zyBooks & O, 8.20 Homework 6 - String This homework requires you to write three functions as

python, pls follow all requirements thank you
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
= zyBooks & O, 8.20 Homework 6 - String This homework requires you to write three functions as described below 1. Write a function called swap that takes a string and two integers and swaps the letters found at the locations of the two letters. The locations of the letters is calculated starting at one. The new string should be returned. 3 7 Input: Output: I am boggled! I om baggled! 2. Write a function called uncompress that takes a string comprised of combinations of integers followed by letters. The integer represents the number of instances of the character that follows that should be in the final string. You should return the uncompressed string. Input: 1mli2sli2sli2pli = zyBooks & 0 , 2. Write a function called uncompress that takes a string comprised of combinations of integers followed by letters. The integer represents the number of instances of the character that follows that should be in the final string. You should return the uncompressed string. Input: 1mli2sli2sli2pli Output: mississippi 3. Write a function called longestword that takes a string of compressed words (as in number 2). The function should use the uncompress function to uncompress each of the words contained in the string. The function should print the longest word and the length of the longest word. Input: 1mli2sli2sli2pli 1b12olg10e 5a2h Output: boooo000000oogeeeeeeeeee 24 = zyBooks G O 3. Write a function called longestword that takes a string of compressed words (as in number 2). The function should use the uncompress function to uncompress each of the words contained in the string. The function should print the longest word and the length of the longest word. Input: 1mli2 sli2 sli2pli 1b12olg10e 5a2h Output: boooooooooooogeeeeeeeeee 24 4. You are to write a function that takes a real-word word or phrase and inserts gibberish in order to generate a password. The function must be called gen_password and it must take a string representing the real-world word or phrase and a string of 2-3 gibberish characters. You must return a password that is the original word or phrase = zyBooks @ @ 0. 4. You are to write a function that takes a real-word word or phrase and inserts gibberish in order to generate a password. The function must be called gen_password and it must take a string representing the real-world word or phrase and a string of 2-3 gibberish characters. You must return a password that is the original word or phrase reversed and the vowels in the original word replaced with the gibberish characters. Input: "thataway", "*!" Output: y*!*!t*!ht In order to test, you must include your test code at the end of the file within the section: if __name__ == '__main__': This section should only test the longestword function. The rest of the functions will be tested via unit tests. ACTIVITY 8.20.1: Homework 6 - Strings and List

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions

Question

Is it clear what happens if an employee violates the policy?

Answered: 1 week ago