In this WSQ I have fun with numbers, again! I’m sure my code can be optimized but I tried to write it as clean i.e. readable, as possible. So yeah, all I did was print some options for the user and ask for two numbers to work with. Finally, I created some functions so they are […]
In this lesson I will show you how to write and call a function in order to simplify the structure of any program. Creating a function: A function in C++, a function is a group of statements that is given… Continue Reading →
In this lesson I will show you how to write and call a function in order to simplify the structure of any program. Creating a function: A function in C++, a function is a group of statements that is given… Continue Reading →
Functions in Python are very easy to use, they do specific actions with the value you call them. The function substitute a value into a block of code and the returns the calculation (or sometimes they do nothing). For example, you have probably used before the print function:
Calling a function
Creating a function
Notes
You can see my code here.
This is my code in action!
(The credit of the image goes to https://flic.kr/p/4C37pr) Welcome to this special post. As you can see, it is a quiz. Here are my codes: https://github.com/anagloriaac/QUIZ06/blob/master/q1.cpp https://github.com/anagloriaac/QUIZ06/blob/master/q2.cpp
(The credit of the image goes to https://flic.kr/p/4C37pr) Welcome to this special post. As you can see, it is a quiz. Here are my codes: https://github.com/anagloriaac/QUIZ06/blob/master/q1.cpp https://github.com/anagloriaac/QUIZ06/blob/master/q2.cpp
Fun Quiz, a little bit tricky but fun, there’s a lot stress on this one, a lot people failed. But as Ken says it’s #OkToFail. Well back to business, in the first part of the quiz is make a function called “superpower” able to ask for two numbers and return the power of it on […]
This is my WSQ08This one was really easy, its the basic use fo a function, nothing hard or complex. I used a lot of functions on this excersise but I think that it could be done with only one function. Here is my code: And this is the program work…
This activity has to have the same result as WSQ03, but with functions. It was not hard to do this activity, I didn’t have big problems, just some little details. But I did have one which I wasn’t expecting: I used the shortcuts of the operations as the first 3 letters to keep it simple. Product was “pro”, for example, but the problem came with the division, because “div” is used in C++ as a command, so when I tried to run in, Terminal read it as a command instead of a variable. When I realized that, I changed the variable for “divv” so it becomes a variable again. It ran perfectly after that.