The number 4 was returned. Just to show that the addition sign tells the computer to add the numbers. After that I entered a couple more different expressions.
This chapter so far pretty much covered really basic algebra defining what an expression was and how to store values into variables(spam = 15, if you took a box and wrote spam on it. You could then take any value and place it inside that box). Once you define a variable and place a value to that, you can use it in an expression.
For example:
If I define spam...or in this case Homework it'll look like this.
>>>homework = 15 #<---These forward slashes are for commenting. Anything that follows them will no be #process by the compiler. The value of the homework is now 15. We homework has #been defined and can now be used in an expression like so.
>>> homework + 10
25 #You have been returned the value 25 because 10 was added to your homework value(15)
You aren't limited to just one variable either. You can you multiple variables.
Like so:
>>> EOP = 310
>>> CSUN = 16
>>>homework = EOP + CSUN #Here I've assigned a new value to homework. So when I typed >>>homework
326 #homework in I get this...
That's pretty much what I've learned for this week.
No comments:
Post a Comment