Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python problem. please do not copy other answers. 4.30 LAB: Magic String The code template below takes as input two strings the first, my_string, is
Python problem. please do not copy other answers.
4.30 LAB: Magic String The code template below takes as input two strings the first, my_string, is a string literal of unknown length, and the second, magicisa three character string Complete the program to assign the variable my_result with one of four pomtible values . 3. if magic is a substring of my_string 2. arry two character substring of maple is also a substring of my_string but magic tself is not, 1 if any of the characters in magic appears in my_string but no two character cubstringe nor magic are substrings of my_string 0, if no characters in magic appear at all in my_string For example, wuppose my_string to the main architect was slartibartfast. Then if magic l'art my result is 3 tingart in a substring of my_string if magicis arx' my result in 2 because ar is a two character nutitring of my_string if magicism my result a 1 because with one character substring of my_string if magicis XJ2my_result in 0, of course You may assume magic always has only three unique characters (that need not be letters). You should assume case sensitivity that is for example a and are not the same letter Some hints 1. The expression magie in my string returns True if the string Meral lobeled with the name magic as a substring of the strongera labeled with the name my string 2 magico returns the oth (that is, the first) character in naglo magic[1] returns the fat (that is the second character in magic and so on 3. magic 0:2) tumsa string bunt from the oth and Tot characters of magic magic (1:1) contains the 1st and 2nd only LAD ACHTY 4 20.1.LAB Magic String 07 main.py Lood dealt template 1 my string out input() 4your code coes here printinyent 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