Jan-31-2018, 03:09 PM
Define a function unique_elem takes two strings str_1 and str_2 as inputs and prints
only the elements that occur in str_1 and not in str_2. Note: You are NOT allowed to
use the in operator.
>> unique_elem(“hello”, “hola”)
e
>> unique_elem(“alyo”, “efendim”)
a
l
y
o
3. Define a function string_reverse that takes a string as input and returns a reversed
version of it.
>> print string_reverse(“sehir”)
rihes
4. Define a function repeat_letters that takes a string and a number n as its two inputs and
prints the string with every letter repeated n times.
>>print repeat_letters(“bla”, 2)
“bbllaa”
pls help me
only the elements that occur in str_1 and not in str_2. Note: You are NOT allowed to
use the in operator.
>> unique_elem(“hello”, “hola”)
e
>> unique_elem(“alyo”, “efendim”)
a
l
y
o
3. Define a function string_reverse that takes a string as input and returns a reversed
version of it.
>> print string_reverse(“sehir”)
rihes
4. Define a function repeat_letters that takes a string and a number n as its two inputs and
prints the string with every letter repeated n times.
>>print repeat_letters(“bla”, 2)
“bbllaa”
pls help me