Python is about programming on computers. It can be used many ways.
Today I programmed in python for a math thing that I am required to do to finish the course of Python on CodeAcademy. I really love how you can do lots with python. Right now, I’m basically doing easy sums of large numbers and telling it what type of math it is. Then I am going to print the answers! I’m not done with this programming but I think that’s what its going to do.
I also did a thing called Modulo. Which is when you put two numbers with a % in between them and it says how many second numbers that can go into the first number and it prints the number. I did 3 % 2 and I got 1.
I want to set a goal to finish the 11hr python course in 3 weeks at most.
I have earned another badge! This one was earned for calculating the money, tips and tax altogether.
Using strings, I told the programming operator that I had meal price = 44.50, tax = 0.0675 and tip 0.15. I added all of them together after in a big string and that resulted in the end result coming up on the screen, much like a calculator. I had to tell the computer beforehand that I had meal, tax and tip for this to be a “restaurant tip calculator”. I could have told it I had many other things and still had same results if I put In the same numbers.
Today in python I did string correcting. Strings are sections of code or text on a line (correct me if I’m wrong please!) The sentence is ‘This isn’t flying, it is falling with style’. This course today required me to connect a string together. In CodeAcademy, you can tell whether it is together or not because of the text colour, it’s together when it’s all yellow on the line and when it’s different colours it’s not together and its doing parts of the line when running the code. In this case, you fix it by adding a slash (\) because the ‘ (apostrophe) in between the isn’t is breaking it up. Adding a slash after the apostrophe fixes the problem.
Today I learnt “String Methods”. It’s where your do a specific task with the string.
There are different types; str(), lower(), upper() and len(). The one I learnt to use is len(). It is short for length and when inputted correctly, or as wanted, you can get the amount of characters it a word or sentence.
I had to find out the number of characters in the words “Norwegian Blue”. So I made a variable called parrot and set it to “Norwegian Blue”. Then I input for the computer to print/text out the amount of letters in the variable parrot (“Norwegian Blue”).