*** scooper has quit (Ping timeout: 480 seconds) | 08:07 | |
*** sysadmin_ has quit (Quit: Leaving) | 09:55 | |
*** jelkner_ has quit (Remote host closed the connection) | 11:56 | |
*** jelkner has quit (None) | 11:56 | |
*** Janet has quit (Read error: Connection reset by peer) | 12:29 | |
*** tboimah has quit (Read error: Connection reset by peer) | 12:29 | |
*** fkoikoi has quit (Read error: Connection reset by peer) | 12:29 | |
*** lendary has quit (None) | 13:52 | |
ubuntourist | Janet, tboimah, fkoikoi, ledmer Shhhhowtime! 😉 | 14:02 |
---|---|---|
ubuntourist | How's everyone doing this new year? I've got my Diet Coke and am, as usual "dark and surley" | 14:03 |
ubuntourist | (as opposed to "bright and early"). | 14:03 |
*** tboimah has quit (Ping timeout: 480 seconds) | 14:04 | |
*** Janet has quit (Ping timeout: 480 seconds) | 14:04 | |
*** fkoikoi has quit (Ping timeout: 480 seconds) | 14:04 | |
ubuntourist | ....aaaand, everybody drops out. Gonna be one of THOSE days. | 14:04 |
ledmer | Hi! | 14:05 |
ubuntourist | ledmer, I guess everybody didn't drop out. 😉 Hi. | 14:06 |
ubuntourist | ledmer, How goes the Python exploration? | 14:07 |
ledmer | pretty well | 14:07 |
ubuntourist | ledmer, I need to actually take a look at the course. I did get an account, | 14:08 |
ubuntourist | but have not really looked at what material is covered and in what order. | 14:08 |
ledmer | what material? | 14:09 |
ubuntourist | ledmer, I thought everyone was studying from a web site that offers the certification test | 14:09 |
svaye | Good afternoon Mr Cole | 14:10 |
ubuntourist | ledmer, at the end. The material offered by that web site. | 14:10 |
ubuntourist | svaye, Hi. How is the Python study going for you? | 14:10 |
svaye | it's going on fine for me, I am currently on modulo 3 | 14:11 |
ubuntourist | svaye, module 3 😉 modulo 3 means something different entirely. | 14:12 |
svaye | sorry module 3 actually | 14:12 |
ubuntourist | (modulo 3 means "the remainder, after a number is divided by 3. So "5 modulo 3" = 2.) | 14:13 |
ubuntourist | svaye, I was just saying to ledmer that I need to take a serious look at the course so that I know what is covered in each module. | 14:14 |
ubuntourist | Any questions or tricks you'd like to show off? | 14:14 |
*** ledmer has quit (Quit: Leaving) | 14:15 | |
svaye | I've learned how to use the symbols in python | 14:16 |
svaye | the mathematical symbols which is +,=,/, * | 14:18 |
svaye | I also learned about the input function | 14:18 |
ubuntourist | svaye, Typically, we refer to these as "operators" and the variables or constants that are used with them are "operands" | 14:19 |
svaye | okay | 14:19 |
ubuntourist | Some "operators" are "unary" and some are "binary". For example, "-" is both a unary and binary operator. | 14:20 |
ubuntourist | that means it can be combined with one operand (unary) or two operands (binary): | 14:20 |
ubuntourist | -x or -5 is how "-" is "unary": It takes a single operand and negates it. | 14:21 |
svaye | alright | 14:21 |
ubuntourist | (5 - 2) and (x - y) are examples of using the - operator with two operands, and so in these cases it is being used as a binary operator. | 14:22 |
ubuntourist | Binary operators are much more common than unary operators. | 14:23 |
svaye | Is "+" also a unary operator? | 14:24 |
ubuntourist | svaye, yes, but it's never really necessary: +5 is the same as 5, +x is the same as x. | 14:25 |
ubuntourist | svaye, there may be some situation where you are writing code and you want to make it VERY clear to someone else reading your code | 14:25 |
ubuntourist | that a number is a positive number, but I cannot think of a situation where I've seen that. | 14:26 |
svaye | okay | 14:27 |
svaye | it's the same in math class, you don't have to attach "+" to a number to know that it's positive | 14:28 |
ubuntourist | svaye, exactly. | 14:28 |
ubuntourist | One thing that sometimes confuses new programmers is the "=" | 14:29 |
ubuntourist | In math class, it is used to indicate that two values are the same. In programming, it is used to ASSIGN a value to a variable. | 14:30 |
svaye | and "==" is used to indicate that two numbers are equal | 14:30 |
ubuntourist | And, when it appears twice "==" is is used as a COMPARISON operator. It asks the question "Are these two values identical?" | 14:31 |
ubuntourist | svaye, well, it's used to ask if the two numbers are equal. It is an operaton that produces a value "True" or "False" | 14:32 |
svaye | okay | 14:33 |
ubuntourist | For example try typing into the Python REPL (interactive prompt): | 14:33 |
ubuntourist | x = 5 == 6 | 14:33 |
ubuntourist | print(x) | 14:33 |
ubuntourist | y = 5 == 5 | 14:34 |
ubuntourist | print(y) | 14:34 |
svaye | the result is False, True | 14:35 |
ubuntourist | svaye, and do you understand why? | 14:35 |
svaye | yes | 14:35 |
svaye | the first one is False because 5 is not equal to 6 | 14:36 |
svaye | and the second one is True because 5 is equal to 5 | 14:36 |
ubuntourist | True and False are known as Boolean values, and there are Boolean operations that allow you to manipulate Boolean values. | 14:37 |
ubuntourist | Understanding Boolean operations can become very helpful when you are writing programs with lots of dependencies and conditions. | 14:38 |
ubuntourist | For example, you may have a situation where you ony want to print a message when: | 14:39 |
ubuntourist | 1) a user has answered "Yes" to some question, AND | 14:39 |
ubuntourist | 2) a file with a specific name exists on your computer, AND | 14:40 |
ubuntourist | 3) it is after 12:00 noon, AND | 14:40 |
ubuntourist | 4) the computer is running low on disk space, AND | 14:41 |
ubuntourist | 5) ... | 14:41 |
ubuntourist | each of those is a condition with a Boolean value, but you only want to print a value if ALL of them are "True". | 14:42 |
ubuntourist | Or maybe, you want to print something if ANY of them are True. In that case you would be combining them with the Boolean operator for OR instead of AND. | 14:43 |
ubuntourist | Sometimes, you will want to check for all possible combinations, and do something different for each one. | 14:44 |
ubuntourist | Usually, to be certain that I have covered all possible combinations, I will create a "truth table" that | 14:45 |
ubuntourist | shows every poassible combination of True and False. So for the above, I have 5 conditions. A truth table would have | 14:46 |
ubuntourist | five variables, each one representing a conditon above. lets use "response", "exists", "afternoon", "low", and "other". | 14:47 |
ubuntourist | ACTION creates a truth table. hold. | 14:48 |
ubuntourist | ACTION is back. That took longer to type than I thought. 😉 | 14:56 |
svaye | okay | 14:56 |
ubuntourist | Join me on the server: | 14:57 |
ubuntourist | ssh wwgdJzrYfSTL8bX2RnJUcQYvN@lon1.tmate.io | 14:57 |
*** jelkner has quit (Ping timeout: 480 seconds) | 14:58 | |
ubuntourist | With five conditions, there are 32 combinations of True and False | 14:58 |
ubuntourist | I typed the first eight, and the final one. I sikpped several because it was taking too long to type. | 14:59 |
ubuntourist | At the end of each line is the result of combining all five conditions using AND | 15:00 |
ubuntourist | When using AND to combine Boolean values, the result is always False unless ALL conditions are simultaneously True. | 15:01 |
ubuntourist | (I did not have space for the full variable names in the last column. So: | 15:02 |
ubuntourist | R & E & A & L & O | 15:02 |
ubuntourist | means | 15:02 |
ubuntourist | response AND exists AND afternoon AND low AND other | 15:02 |
ubuntourist | I used the first letter of my variable names.) | 15:03 |
ubuntourist | svaye, okay? | 15:03 |
svaye | okay | 15:03 |
ubuntourist | I don't know how much experince you have had with base 2 (binary) math but it is very, VERY helpful to understand | 15:04 |
ubuntourist | that binary math and Boolean truth tables are "joined at the hip" -- they are very similar concepts and there is a topic called Boolean | 15:05 |
ubuntourist | algebra that teaches how these two concepts of True / False and 1 / 0 can be manipulated. | 15:06 |
svaye | okay | 15:07 |
ubuntourist | By listing out all 32 combinations, I can have situations where I want to print one thing when "response" and "afternoon" are True but everything else is False, | 15:08 |
ubuntourist | and I want to print something else when "exists" is True, regardless of the values of all other conditions. | 15:08 |
ubuntourist | Since I have 5 conditions, binary arithmatic tells me that I have 2^5 combinations possible, i.e. 32 (2 to the fifth power). | 15:09 |
ubuntourist | Boolean operators include "and", "or", "exclusive or", "not", "nand", and "nor". Python doesn't offer all of these as keywords. It offers "and", "or" and "not". | 15:12 |
ubuntourist | There are ways to get the others, and there are similar operators called "bitwise" operators, but you probably won't need to know about those for a while. | 15:13 |
ubuntourist | For now, the important ones will be and, or and not. | 15:13 |
svaye | alright | 15:14 |
ubuntourist | I really should look at the modules you're studying, since I don't want to introduce too | 15:14 |
ubuntourist | much new information if it will create confusion. But one of the things that I believe made me more successful | 15:15 |
ubuntourist | than some of the students in my classes was the fact that I learned about binary math and truth tables very early, and it was extremely helpful to me. | 15:16 |
svaye | I will read on it more to understand it better | 15:17 |
ubuntourist | (When I was in elementary school, I received a gift, a book by a mathematician named George Gamow (I think). The book title was "One, Two, Three, Infinity" | 15:18 |
svaye | was he the one who wrote | 15:19 |
svaye | it | 15:19 |
ubuntourist | and it talked about different ways to count, and it explained Base Two (Binary). I thought this was very cool, and I used it to write "secret" notes to my friends. | 15:20 |
ubuntourist | Today, I think parts of the book would be considered very offensive and racist or sexist. But the information that it gave me was very valuable. I hope it has been revised. But if not, I am sure there are other books. | 15:22 |
ubuntourist | It "reshaped" my brain, I think. 😉 | 15:23 |
svaye | I just searched for it and I saw something | 15:23 |
ubuntourist | It has been a very, very long time since I read it, but I still remember how it made me think about numbers in a very different way. | 15:24 |
svaye | alright | 15:25 |
ubuntourist | One more thing: Going back to what you said when we started, about learning to use the operators +, -, *, / and =. | 15:26 |
ubuntourist | Did the module cover the "shortcut use" of the assignment operator "="? | 15:27 |
svaye | operator "=" assigns a value | 15:27 |
ubuntourist | You can combine the = with other operators to "shortcut" your typing. | 15:28 |
ubuntourist | An example would be: | 15:28 |
ubuntourist | t = 0 | 15:28 |
ubuntourist | for i n range(10): | 15:28 |
ubuntourist | t += 1 | 15:29 |
ubuntourist | print(t) | 15:29 |
ubuntourist | Try that. Then try it again with "2" or "5" or some other number instead of "1" | 15:30 |
ubuntourist | +=, -=, *=, /=, etc. are ways to abbreviate and shortcut. | 15:31 |
ubuntourist | "t += 1" means "t = t + 1" and it is the same for the others. ("t *= 4" means "t = t * 4", etc.) | 15:32 |
jelkner | ubuntourist, i'm in class, but i just wanted to say hi! | 15:33 |
svaye | Good afternoon jelkner | 15:33 |
jelkner | good afternoon, svaye | 15:34 |
ubuntourist | jelkner, hi. Attendence is a bit thin today... Looks like there was network trouble. | 15:34 |
jelkner | sadly, it happens | 15:34 |
jelkner | but your email was a huge help | 15:34 |
jelkner | btw, ubuntourist, we need to find a time to catch a meal together | 15:34 |
ubuntourist | jelkner, we've been talking about Boolean values and truth tables. | 15:34 |
jelkner | any plans to come to Virginia Square? | 15:35 |
jelkner | apologies | 15:35 |
jelkner | don't mean to interrupt | 15:35 |
ubuntourist | jelkner, there's got to be one coming up soon. | 15:35 |
jelkner | let me know when | 15:35 |
jelkner | so i can meet you for pizza after | 15:35 |
ubuntourist | jelkner, that's okay, I'm running out of things to say and was going to call it quits early. | 15:35 |
jelkner | great then. | 15:36 |
jelkner | let me know the next saturday you're coming to Virginia Square | 15:36 |
ubuntourist | jelkner, will do | 15:37 |
jelkner | thanks! | 15:37 |
ubuntourist | svaye, So, any questions? | 15:37 |
svaye | I am clear for now | 15:38 |
ubuntourist | svaye, well then, I'll chat with you next time. Bye for today! | 15:38 |
svaye | Have a nice day Mr Cole | 15:39 |
*** ubuntourist has quit (Quit: Leaving) | 15:39 | |
svaye | Have a nice day jelkner | 15:39 |
svaye | ACTION signs off | 15:39 |
*** svaye has quit (Quit: Leaving) | 15:39 | |
*** jelkner has quit (Quit: Leaving) | 15:58 | |
*** shmohamud has quit (Remote host closed the connection) | 21:54 | |
scooper | Good afternoon Sahnun | 21:56 |
*** shmohamud has quit (Remote host closed the connection) | 21:59 | |
shmohamud | good afternoon Spencer | 22:05 |
scooper | Good afternoon Sahnun | 22:05 |
shmohamud | What is the output of the following code: | 22:06 |
shmohamud | print("My\nname\nis\nBond.", end=" ") | 22:06 |
shmohamud | print("James Bond.") | 22:06 |
shmohamud | Remember you are not allowed to run it in the sandbox | 22:07 |
scooper | ok | 22:07 |
scooper | what name is equal to | 22:08 |
scooper | is a variable or name is just a string here | 22:08 |
scooper | I can explain the code | 22:10 |
shmohamud | There's no need to know what name is equal to | 22:11 |
shmohamud | To know what's printed. Note that it's a string in there, so name is really just part of a string. | 22:11 |
shmohamud | Scooper I'm sorry I have to leave for the day. My friend's wedding dinner is in 45m and I need to prepare and travel there. | 22:13 |
scooper | each value will print a on a seporate line | 22:13 |
scooper | My | 22:13 |
scooper | name | 22:13 |
shmohamud | Ok scooper, let's reconnect Monday. Keep practicing on your own and we'll work through more practice problems | 22:13 |
scooper | Ok | 22:14 |
scooper | you just save me the time to sleep | 22:14 |
scooper | thanks Sahnun | 22:14 |
shmohamud | Alright well sleep well | 22:14 |
*** scooper has quit (Quit: Leaving) | 22:17 | |
*** shmohamud has quit (Remote host closed the connection) | 22:25 | |
*** shmohamud has quit (Ping timeout: 480 seconds) | 23:11 |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!