In this assignment you will estimate the mathematical constant e. You should create a function called calculuate_e which receives one parameter called precision that should specify the number of decimal points of accuracy.
You will want to use the infinite series to calculate the value, stopping when the accuracy is reached (previous and current calculation are the same at the specified accuracy).
On the past Wednesday i was attending an event with my little sister called “Women in computing”, the idea behind this was to bring women engineers working on the tech industry to share their experiences and encourage other women to work on technology.
The truth is that even though I wasn’t part of the target audience I really enjoy it and learn a lot.
The first exponent was Elizabeth López an Oracle engineer that told us about the serious problem of the lack of women in our industry, among other things.
Now, as someone that its working on get a degree in engineer I know that this it’s a sadly truth.
Then after a few minutes she came up with reasons about why we don’t have to many women in tech.
The first one it’s that too many women are interested in science.
Second, the small part that its interested in science are not interested in IT
Finally, she made a very good work trying to motivate and encourage to other women to study not just IT but to reach their potential and made it clear that IT it’s not just about programming.
The last and second speaker was Mireya, she was a former employee at CISCO Systems and now it’s an employee at Oracle with a managerial position.
Her talk was interesting, she told us about her life and the experiences that gave shape to her career.
The story that I enjoy it the most was when she told us that gave up a promotion because she wanted to spend more time with her childs and if she took it she would be transferred, at the end she concluded.
“Even though I gave up to the promotion i handle it to get the opportunity to
To find out how many times the word banana its found it on a text file, we firstly will create our own file. Once we do that we will create another function that will help us to finish the main program, this function is going to use the string module to transform each character of a string into a lower case letter. If the character can’t be transform it will omit it and just don’t add it into a new variable.
Then it will return a new string which will be a copy of the original one, but this time without characters that are not lower case letters. This function will be called “Just_lowercases”.
Then we are going to create our main program “find_bananas”, this program will use a counter and a for loop that will iterate on each line of the text and on each line will call the “Just_lowercases” function that will convert the text and use the “count” method to count how many times the word “banana” its found it.
I read that on windows if we don’t use the close() function once we open a file using python, the file will have troubles later, i forget to do it the first time but nothig happened. Nevertheless just in case we will do it to avoid posibles errors.
In this assignment you will write a function to calculate the square root of a number using the Babylonian method. You can search for that method, it will be easy to find.
The function should receive a number and return floating point number. Obviously you should test your function, so create a main program that asks the user a value, calculates the square root and displays that.
To find the square root of our given number we are going to create a funciton with a while loop, this loop will be execute untill the square root calculated using the babylonian method reaches a precision of a thousandths decimals.
If you want even more details about this exercise you can read it here on another blog post that i made.
In the “distance” function we will create a function that takes 4 paramethers and return us the formula of distance between 2 points.
We are not going to use them on this point but, for the rest of the #WSQ11 we are going to use the math module and the string module, i will point it out when the time to use them comes, nevertheless im not repeating how to import both in the same file. So keep atention and see the picture because this is the way to do it.
In order to make the second one we will create 2 for loops, one in wich the i variable is going to be increasing untill the value is the same as a. On the second one our i variable will be decreasing untill the value is 0.
We will create a function that using an if will determine if the factorial of the number its going to be find it using an algorithm or by just returning 1. (Which is the case for 0 and 1 factorial).
If the algorithm its required we are going to set the formula on a while loop and stops the loop if our counter reach our given number.
To calculate the main of a list we will create a for loop that is adding each one of the elements of our list in a variable to finally divide this value by the number of elelements (wich is found it using a counter that counts on every iteration).
To find the samaller number between 4 values, i created a function that determines the smaller number between two values, it wasn’t the most eficient