Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 5 Write a function called 1337encode) that takes a string as an argument and returns a string in which the following substitutions have been
Problem 5 Write a function called 1337encode) that takes a string as an argument and returns a string in which the following substitutions have been made A or a 4 Borb> 8 Eore3 Sors5 Tort7 All other letters should be capitalized Note, there are several ways to solve this. The easiest uses string.replace,but for a greater challenge, solve this using a loop and comparisons, or a dictionary E.g.: 1337encode ("Bob s an eleet haxor") "808 15 4N 31337 H4XOR" Problem 6 Write a function called remove) that takes two strings as arguments: the source, and the token. The function should remove all instances of the token from the source string. Note The built-in string.replace) is particularly well suited to this task. For additional practice solve this problem using string.find) and string slices(:] instead E.g.: remove ("This is as it is.", "is" >'Th as it .' Problem 7 Write a function that takes a string s and an integer n as arguments. The function should then return the nth word from that string (or an empty string if no such word exists). As a bonus challenge, try solving this without the use of the str.split() method. For an even greater challenge, try solving it without the str.find) method as well E.g nthWord ("One two three four five six seven", 3)> 'three' nthWord ("Hello",3) >
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started