Question: Help with writing this python code please. short explanations if possible, thanks. 1. Write a function compare (s1,s2) that takes as inputs two string values

Help with writing this python code please. short explanations if possible, thanks.Help with writing this python code please. short explanations if possible, thanks.

1. Write a function compare (s1,s2) that takes as inputs two string values s1 and s2, and that returns the string that comes later in the dictionary (i.e., the string that is greater according to the > operator). For example: > compare ('program', 'code') \#'program' > 'code' result: 'program' 2. Write a function combine (s1,s2,n) that takes as inputs two strings s1 and s2 and an integer n, and that returns a new string in which the last n characters of s1 are followed by the first n characters of s2. For example: > combine('computer', 'science', 3) result: 'tersci' >> combine ('python', 'code', 2) result: 'onco' If either string (s1 or s ) does not have at least n characters, you should use all of its characters: > combine('amazing', 'you', 4) result: 'zingyou' 3. Write a function reverse_n(vals, n ) that takes as inputs a list vals and an integer n, and that constructs and returns a new list in which the first n values of vals are reversed and all other values from vals remain in their original positions. For example: result: [3,2,1,4,5,6]# reversed the first 3 values

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!