Please follow the instructions line by line, make sure you get the correct logic if you don't know the python program or
Posted: Fri Jul 01, 2022 5:51 am
Please follow the instructions line by line, make sure you getthe correct logic if you don't know the python program or don'tunderstand this problem, plz don't answer it otherwise I will putbad reviews make sure you provide the source code and screenshot ofthe source code on visual studio and the output as well! do notpost someone else’s answer.
Problem Statement: Description: Write a Python function that accepts a non-empty string, input_string as input parameter and returns a non-empty output_string based on the below logic: • If the first and last character of input_string are same, then initialize output_string with first character of input_string in uppercase Example: input_string: 'xyzax' output_string: 'X' . Question 2 Note: Perform case-insensitive comparison • Otherwise, identify the characters present at even index positions in the input_string as even_pos_string. If the last character and second last character of even_pos_string are same, then initialize the output_string with even_pos_string Example: input_string: 'B3ac919' output_string: 'Ba99' Note: 0 Perform case-sensitive comparison O Even index positions in input string would be 0, 2, 4, ... Otherwise, initialize the output_string with the first three characters of input_string Example: input_string: 'eBa2A' output_string: 'eBa' Assumptions: The input_string would have at least three characters • The input string can be alphanumeric The first character of input string would always be an alphabet Note: No need to validate the assumptions • The order of execution would be the same, as specified above
Sample Input and Output: input_string output_string 'vd12V' 'V' 'c1s2s' 'css' 'a23Q42' 'a23' Starter Code provided below: #Do NOT Change any part of the code provided to you def string_function(input_string): output_string=" #Write your logic here return output_string #You can test your functionality by providing different inputs input_string='vd12V' output_string=string_function(input_string) print (output_string)
Problem Statement: Description: Write a Python function that accepts a non-empty string, input_string as input parameter and returns a non-empty output_string based on the below logic: • If the first and last character of input_string are same, then initialize output_string with first character of input_string in uppercase Example: input_string: 'xyzax' output_string: 'X' . Question 2 Note: Perform case-insensitive comparison • Otherwise, identify the characters present at even index positions in the input_string as even_pos_string. If the last character and second last character of even_pos_string are same, then initialize the output_string with even_pos_string Example: input_string: 'B3ac919' output_string: 'Ba99' Note: 0 Perform case-sensitive comparison O Even index positions in input string would be 0, 2, 4, ... Otherwise, initialize the output_string with the first three characters of input_string Example: input_string: 'eBa2A' output_string: 'eBa' Assumptions: The input_string would have at least three characters • The input string can be alphanumeric The first character of input string would always be an alphabet Note: No need to validate the assumptions • The order of execution would be the same, as specified above
Sample Input and Output: input_string output_string 'vd12V' 'V' 'c1s2s' 'css' 'a23Q42' 'a23' Starter Code provided below: #Do NOT Change any part of the code provided to you def string_function(input_string): output_string=" #Write your logic here return output_string #You can test your functionality by providing different inputs input_string='vd12V' output_string=string_function(input_string) print (output_string)