Tag Archives: #mastery12

Creating Python functions

First you define the name of the function and add in parenthesis the variable you’re gonna use, then you must equal different variables to the ones you’re gonna use for your program, after that you can create the logic of the function, or what it’s supposed to do with said variables, finally you can return the result.

Creating Python functions

Creating Python functions

Creating Python functions

– Creating Python functions                                                                           @PablO_CVi

To create a function in python you have to know a command it is def, after this you put the name of your function and between it the variables that your function will work, the next step is writing your function, you can use loops and statements, when your function is done, the last step is a return this means that your function is done.

Here is my example code: https://github.com/PablOCVi/Mastery

Mastery 12

In C++, a function is a group of statements that is given a name, and which can be called from some point of the program. The most common syntax to define a function is:

type name ( parameter1, parameter2, ...) { statements }

Where:
– type is the type of the value returned by the function.
– name is the identifier by which the function can be called.
– parameters (as many as needed): Each parameter consists of a type followed by an identifier, with each parameter being separated from the next by a comma. Each parameter looks very much like a regular variable declaration (for example:int x), and in fact acts within the function as a regular variable which is local to the function. The purpose of parameters is to allow passing arguments to the function from the location where it is called from.
– statements is the function’s body. It is a block of statements surrounded by braces { } that specify what the function actually does.

Let’s have a look at an example:

 

Mastery 12 Creating Python Functions

In this mastery I am going to explain how to create function in python. First  the sintax of  the function is “def”, it has to start always with that, after is the name of the function(is what ever you want it),next to the name is going to be the argument and put the tho dots at the end.In the following lines you have to define what is going to do your function, it depends of what do you want. To finish the statement return is going to be the output of the function (what is going to print the function).

also here is a link where you will found more information : http://librosweb.es/libro/python/capitulo_4/definiendo_funciones.html

 

Mastery12. Creating Python Functions

For this mastery im going to explain how to create a function in Python, which is very simple.

You can see in the screen capture above the syntax, which is composed by the word “def” followed by the name you are giving the function and the argument of this one, also, dont forget to put the tho dots at the end. In the following lines you have to define what your function is going to do, and this can vary depending of the functionality of this.

The statement return is the output of the function, is what the function is going to return the user with a giving parameter.

 Also you can check for more information here: http://www.tutorialspoint.com/python/python_functions.htm

Mastery12

Hi everyone

I just created a video on how to create functions in C++. In this video I expain the syntax of a function, and I also show how to create it. I hope you find it useful.

By the way, my video of mastery 11 explains how to call functions, so I recommend you to check it. 

Here´s the link https://www.youtube.com/watch?v=HKN9bzm1gUs&feature=youtu.be&hd=1

#TC1017 #mastery12: Creating Functions

Hey! I just completed a PDF tutorial on how to create functions. This complements Tutorial , which showed how to call the functions. Hope you like it!

Here’s the link:

https://drive.google.com/open?id=0B7w3BFfqL9oQUE5fdmRoTlZCV0k&authuser=0

#Mastery12

Creating C++ functions

In C++, a function is a group of statements that is given a name, and which can be called from some point of the program. You need a type of the value returned by the function,  a identifier by which the function can be called, and parameters. Each parameter consists of a type followed by an identifier, with each parameter being separated from the next by a comma. Each parameter looks very much like a regular variable declaration and in fact acts within the function as a regular variable which is local to the function. The purpose of parameters is to allow passing arguments to the function from the location where it is called from.

This is one example I did for WSQ08

Creating Python functions. Mastery 12.

To create a Python function you need to write the word def followed by an space and the name of your function with a parenthesis, in the parenthesis you should write a letter for as many arguments you want the function to have, after the right parenthesis you put ‘:’. See examples following.

 

To define a function without argument you write:

def mensaje():

                print (“Este es el mensaje contenido por la función”)

To define a function with one arguments, you write:

def mostrar(a):

                print(a)

To define a function with two arguments, you write:

def sum(a,b)

                print (a+b)

 

and so on!

Creating c++ functions

Para crear una función en c++ primero necesitas declarar una variable la cual va a ser el resultado de tu función, una vez decladara nuestra variable lo siguiente es asignarle la función, por ejemplo si nuestra variable es “a” podemos decir que “a = 3*2” y eso es una función o bien también podriamos pedirle que al usuario que le de valor a “a” y entonces otra funciona sería que “a= a*2”. Aquí dos ejemplos