Saturday, 24 September 2016

def mathematics

This evening and what I had stumped me within and got me less interested in coding the first time, stopping me from progressing was the use of functions and how they were being taught on how to be used.

I understand the main process, defining what the function is, giving it a value and what the units have, but yet the task on the website seemed to stump me continuously, causing me dismay and doubting whether or not I could actually do coding if I could get past this basic question.

Directly from the website.

In this exercise you'll use an existing function, and while adding your own to create a fully functional program.
  1. Add a function named list_benefits() that returns the following list of strings: "More organized code", "More readable code", "Easier code reuse", "Allowing programmers to share and connect code together"
  2. Add a function named build_sentence(info) which receives a single argument containing a string and returns a sentence starting with the given string and ending with the string " is a benefit of functions!"
  3. Run and see all the functions work together! "
And what I have written so far, unknowing to whether or not I was doing it correctly, the wording stumps me and wondering whether or not I am confusing it even more, this is what I had worked out so far.

def list_benefits(a, b, c, d):
    return "More organized code", "More readable code", "Easier code reuse", "Allowing programmers to share an/d connect code"
def build_sentence(info):
    print " is a benefit of functions!"
def combination_of_sentences():
    list_of_benefits = list_benefits()
    for benefit in list_of_benefits:
        print build_sentence

print build_sentence

I am unknowing in how to get my function to properly function, the page does not show how to properly execute the script and it is highly confusing, it seems quite bizarre to me for this to be in the pages without actually showing how to make the code correctly return what you need.
Is there a need for raw_imput, or something else, if so, what is needed?

Yet I show the confusion I have fully understood what their mathematic processes are used for and how to use the.
The obvious symbols being.
+ for addition
- for subtraction
* for multiplication
/ for division
** power of " "

Also using the uses of BIDMAS, Brackets, Indices, Division, Multiplication, Addition, Subtraction.

The use of this means making the understanding of maths, and scripting will be brought together much easier, and applying it to robotics and constructing hardware makes much more sense.

This has been a rather confusing and annoying day, but hopefully helping at the same time.

No comments:

Post a Comment