You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wait, we have to do this again? Shoot.
My code this time around is certainly more simple.
Simplest Version of the Code
My code for this revolution around the sun is based around
simple mathematical functions that explore the basic math
code in Python. For my first program, I initialize five
variables, each of which represent a different math function,
ranging from addition to subtraction to an exponential
equation. In Python, the asterisk means multiplication, the
double asterisk means exponents, and the rest of the signs
are relatively straightforward. I then printed each of the
variable to prove that the code runs smoothly, and each of the
variables produced the desired result.
The Next Simplest Version of the Code
The second part of my code branches off of this idea of initialized
variables, in that it takes those variables and simplifies them in
such a way that I can more easily create more complex equations
from them. Instead of writing out each line of math whenever I need
it, I can call from another variable that fits my needs, and use that
in the code’s place. Calling for the multiplication of x times b is the
same as saying that I need to multiply the results of 4×3, and 2 to the
power of 3. I have also found that I can do this for any math equation,
substituting these variables in each of the math functions and each time
I will receive my desired answer. I have also initialized another
variable, which simply is the answer to multiple variables multiplied and
divided by each other. Printing this variable will also result in the
desired response.
The Most Complexest Version of the Code
The last part of my code takes the simpler code from earlier, and adds a
twist to it. For the last piece of code, I can translate each variable
into either an integer, or a float. An integer is a number that is not
also accompanied by a decimal value, whereas a float is a value that has
and uses a decimal value, even if that value is .0. A value can be made
into a float or integer during initialization simply by adding or omitting
the .x value at the end of the numeric value. One caveat to this: the
division math function will automatically make the provided result into a
number with a decimal place, making it a float rather than keeping the number
an integer, even if it is written that way. In addition to this, a result from
a math function with at least one float will cause the provided answer to also
be a float, even if one of the numbers in the problem is an integer.
You can view my (oh so) comprehensive video on this subject