Here is the link on github: https:/
]]>
Here is my #WSQ08 code, the first time I uploaded it had a mistake. This one is the correct version.
Check it!
GH LINK: https:/
]]>
In this program I redo the WSQ03 but this time I made it with functions.
THE LINK THAT REDIRECTS YOU TO THE PROGRAM FILE ON GITHUB IS BELOW
]]>Este video me ayudo a entender funciones en phyton. veanlo es util, les dejo el link:
https:/
GITHUB
]]>remember WSQ03? we had to create a program that asked for two integers and printed the sum, difference, product an stuff. now we will do it again but with functios to calculate those values.
to create funcitons in python we have to define it giving it a name and variables and what we want the function to return:
def suma(a,b):
return (a+b)
ask the user to input two integers and to call the function do this:
a = int(input())
b = int(input())
print suma(a,b)
make a function for each operation and tell the program to print it.
my code:
]]>First, you need to define the function, and state the variables you’re gonna use in parenthesis, they have to be different from the ones you’re gonna use to ask the user the value of these, then you do the operation under another variable, when you are done with this, type return and the name of the variable that contains said operation. You must do this for every function you create.
After that, ask for the original variables, the ones that are supposed to be different from the ones you initially did the function(s) with, create one last variable that will be equal to the name of the function you want, finally print the result using the variable you just created, which contains/is equal to the function.
]]>Para este programa primero investigué como llamar una función, leí en el libro y después vi algunos videos como este https:/
Para llamar una función primero debes hacer la función antes del int main, poner las variables involucradas y llamarlas como en el ejemplo de la imagen. poniendo un nombre asignado a la función para poder imprimirla seguido de la función y ya en un cout pones el nombre que le asignaste para que se imprima las variables que el usuario ingresó deben ir dentro de el parentesis donde pusiste las variables X y Y #WSQ08 #TC1017
]]>To complete this code, I had to watch Ken’s video a few times, to be sure what he did on the top with the functions, at the end I understood, so I recommend you watch the video as well, I’ll leave the link.
https:/
That’s the second part of the code, be sure to check the details. =)
]]>I just have to see Ken’s video of the week.
Here’s the code.
]]>