Question: You will code the following functions in the programming language Python. For help with the syntax you will need to complete the code, please read
You will code the following functions in the programming language Python. For help with
the syntax you will need to complete the code, please read the document "Code Help" that
is included with this assignment. Turn in your assignment as a PDF file.
You can call this function whatever you want, but I'll call it bit'ToTy. The input will
be a bit string, which we will represent as a list of s and s Your function will
interpret each as a tree and each as a fence in our "trees and yards" problem. The
output of your function will be a list, where each component is the number of trees
in a particular yard. For instance, if our bit string is then we have four
yards since we have three fences, one for each in the bit string The first yard has
two trees two s; the second yard has one tree; the third yard has three tress; and
the fourth yard has one tree. Thus, if the input to the function bitToTy is the list
then the output will be the list
Remember that if you have a on either end, that indicates a yard with no trees in it
So if you have the input the output will be
Now let's try a function that I'll call ty'ToBit. The input will be a list, where each
component is the number of trees in that particular yard. The input will be the bit
string that corresponds to the distribution of trees, where is a fence and is a
tree. For instance, if your input is your output will be
Make sure your functions are well documented. You should have oneline comments using
the single line comments with # written in complete sentences that describe what cach line
of code does. You may not import any packages to help you wilh your function.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
