Question: Please use the Python Language, preferabally 2.7, to solve this two probem set about while loops. The parameters and answer template for the solution is
Please use the Python Language, preferabally 2.7, to solve this two probem set about while loops. The parameters and answer template for the solution is also given beneath the problem descriptions.
| Problem 1: | Write code that pairs together every other number in a list. For example, the list [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] would yield ["1,3", "5,7", "9"]. You may not use any built-in functions/methods besides len() and .append(). |
| Problem 2: | Write code that a string from the user and a letter, and returns a new string where each instance of the letter becomes a Q. For example, happybirthday and a yield the result hQppybirthdQy |
#PROBLEM 1 def pair(l1): list1 = l1 return 0 #YOUR CODE GOES HERE (indented) return l1 #END YOUR CODE
#PROBLEM 2 def replace(l1,l2): string1 = l1 string2 = l2 #YOUR CODE GOES HERE (indented) return string1 #END YOUR CODE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
