Question: *using python 1. Write a function flipside(s) that takes a string input s and returns a string whose first half is s's second half and

*using python 1. Write a function flipside(s) that takes a string input*using python

1. Write a function flipside(s) that takes a string input s and returns a string whose first half is s's second half and whose second half is s's first half. If len(s) (the length of s) is odd, the first half of the input string should have one fewer character than the second half, and thus the second half of the output string will be one character shorter in such cases. For example: >>flipside('homework workhome >>>print(flipside('carpets) petscar Hint: We strongly recommend computing len(s)//2 (using the integer- division operator //) and storing the result in an appropriately named variable. You will need to use that value twice in your function, and using the variable in both places with save you from recomputing it. 2. Write a function adjust(s, length) that takes as inputs a string s and an integer length, and that returns a string in which the value of s has been adjusted as necessary to produce a string with the specified length. If s is too short, the value that is returned should be "padded" with spaces on the left-hand side: >>>adjust('alien', 6) alien' >>>adjust(' compute', 10) # pad with 1 space to get a length compute # pad with 3 spaces to get a lengt If s is either the correct length or too long, the value that is returned should consist of the first length characters of s: >adjust('alien', 4) alie >>>print(adjust(' compute', 7)) compute # return the first 4 characters # return the first 7 characters

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!