Follow my 11-year-old adventures with my Raspberry Pi
Today, I read a chapter from “Hello World: Computer Programming for Kids and Other Beginners” about variables and math in Python. I learned about strings, floats, and integers and that all made sense. I learned that ‘word’ and “word” mean the same thing, but ‘word” isn’t allowed.
One thing that I didn’t understand is that 3/2 comes out to 1. I understand that it rounded it off. But why didn’t it round up to 2? By the way, to get the result of 1.5, you just have to type “3.0/2”. At first, I thought that float(3/2), but that just put 1.0. I don’t understand that either.
I also learned that Python uses the PEMDAS rules that I learned in school. It does multiplication and division before doing addition and subtraction in an equation. Like if you have “2+2*2” that will come out to be 6 because it does the 2*2 part first. If I want to do the 2 + 2 first, then I have to type “(2 + 2)*2.
I also learned that symbol for “to the power of” is **. So, 2 to the 10th power would be written as “2**10”. Also, if you type “5 % 2” it gives you the remainder of the division problem. In this case, “7 % 2” would be 1. This could be helpful if we needed to see if a number is even or odd.
I learned that Python is going to get rid of the input command and that I should use the int function with raw_input() instead.
I just got to the part where I’m learning how to input text from a website and it was complicated and I’m tired, so I’ll do it some other time.
My dad asked me to come up with a cool project to do with the raspbpi. What do you suggest? He thought I should make it light something up or make something move. But, I like programs that do things inside of the computer.