IRC log of #novawebdev for Friday, 2024-01-05

*** 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
ubuntouristJanet, tboimah, fkoikoi, ledmer Shhhhowtime! 😉14:02
ubuntouristHow'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
ledmerHi!14:05
ubuntouristledmer, I guess everybody didn't drop out. 😉 Hi.14:06
ubuntouristledmer, How goes the Python exploration?14:07
ledmerpretty well 14:07
ubuntouristledmer, I need to actually take a look at the course. I did get an account,14:08
ubuntouristbut have not really looked at what material is covered and in what order.14:08
ledmerwhat material?14:09
ubuntouristledmer, I thought everyone was studying from a web site that offers the certification test 14:09
svayeGood afternoon Mr Cole14:10
ubuntouristledmer, at the end. The material offered by that web site.14:10
ubuntouristsvaye, Hi. How is the Python study going for you?14:10
svayeit's going on fine for me, I am currently on modulo 314:11
ubuntouristsvaye, module 3 😉 modulo 3 means something different entirely.14:12
svayesorry module 3 actually14:12
ubuntourist(modulo 3 means "the remainder, after a number is divided by 3.  So "5 modulo 3" = 2.)14:13
ubuntouristsvaye, 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
ubuntouristAny questions or tricks you'd like to show off?14:14
*** ledmer has quit (Quit: Leaving)14:15
svayeI've learned how to use the symbols in python14:16
svayethe mathematical symbols which is +,=,/, *14:18
svayeI also learned about the input function14:18
ubuntouristsvaye, Typically, we refer to these as "operators" and the variables or constants that are used with them are "operands"14:19
svayeokay14:19
ubuntouristSome "operators" are "unary" and some are "binary". For example, "-" is both a unary and binary operator.14:20
ubuntouristthat 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
svayealright14: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
ubuntouristBinary operators are much more common than unary operators.14:23
svayeIs "+" also a unary operator?14:24
ubuntouristsvaye, yes, but it's never really  necessary:  +5 is the same as 5, +x is the same as x.14:25
ubuntouristsvaye, there may be some situation where you are writing code and you want to make it VERY clear to someone else reading your code14:25
ubuntouristthat a number is a positive number, but I cannot think of a situation where I've seen that.14:26
svayeokay14:27
svayeit's the same in math class, you don't have to attach "+" to a number to know that it's positive14:28
ubuntouristsvaye, exactly.14:28
ubuntouristOne thing that sometimes confuses new programmers is the "="14:29
ubuntouristIn 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
svayeand "==" is used to indicate that two numbers are equal14:30
ubuntouristAnd, when it appears twice "==" is is used as a COMPARISON operator. It asks the question "Are these two values identical?"14:31
ubuntouristsvaye, 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
svayeokay 14:33
ubuntouristFor example try typing into the Python REPL (interactive prompt):14:33
ubuntouristx = 5 == 614:33
ubuntouristprint(x)14:33
ubuntouristy = 5 == 514:34
ubuntouristprint(y)14:34
svayethe result is False, True14:35
ubuntouristsvaye, and do you understand why?14:35
svayeyes14:35
svayethe first one is False because 5 is not equal to 614:36
svayeand the second one is True because 5 is equal to 514:36
ubuntouristTrue and False are known as Boolean values, and there are Boolean operations that allow you to manipulate Boolean values.14:37
ubuntouristUnderstanding Boolean operations can become very helpful when you are writing programs with lots of dependencies and conditions.14:38
ubuntouristFor example, you may have a situation where you ony want to print a message when:14:39
ubuntourist1) a user has answered "Yes" to some question, AND14:39
ubuntourist2) a file with a specific name exists on your computer, AND14:40
ubuntourist3) it is after 12:00 noon, AND14:40
ubuntourist4) the computer is running low on disk space, AND14:41
ubuntourist5) ...14:41
ubuntouristeach 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
ubuntouristOr 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
ubuntouristSometimes, you will want to check for all possible combinations, and do something different for each one.14:44
ubuntouristUsually, to be certain that I have covered all possible combinations, I will create a "truth table" that14:45
ubuntouristshows every poassible combination of True and False. So for the above, I have 5 conditions. A truth table would have 14:46
ubuntouristfive variables, each one representing a conditon above. lets use "response", "exists", "afternoon", "low", and "other".14:47
ubuntouristACTION creates a truth table. hold.14:48
ubuntouristACTION  is back. That took longer to type than I thought. 😉14:56
svayeokay14:56
ubuntouristJoin me on the server:14:57
ubuntouristssh wwgdJzrYfSTL8bX2RnJUcQYvN@lon1.tmate.io14:57
*** jelkner has quit (Ping timeout: 480 seconds)14:58
ubuntouristWith five conditions, there are 32 combinations of True and False14:58
ubuntouristI typed the first eight, and the final one. I sikpped several because it was taking too long to type.14:59
ubuntouristAt the end of each line is the result of combining all five conditions using AND15:00
ubuntouristWhen 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
ubuntouristR & E & A & L & O15:02
ubuntouristmeans15:02
ubuntouristresponse AND exists AND afternoon AND low AND other15:02
ubuntouristI used the first letter of my variable names.)15:03
ubuntouristsvaye, okay?15:03
svayeokay15:03
ubuntouristI don't know how much experince you have had with base 2 (binary) math but it is very, VERY helpful to understand15:04
ubuntouristthat binary math and Boolean truth tables are "joined at the hip" -- they are very similar concepts and there is a topic called Boolean15:05
ubuntouristalgebra that teaches how these two concepts of True / False and 1 / 0 can be manipulated.15:06
svayeokay 15:07
ubuntouristBy 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
ubuntouristand I want to print something else when "exists" is True, regardless of the values of all other conditions.15:08
ubuntouristSince 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
ubuntouristBoolean 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
ubuntouristThere 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
ubuntouristFor now, the important ones will be and, or and not.15:13
svayealright15:14
ubuntouristI really should look at the modules you're studying, since I don't want to introduce too15:14
ubuntouristmuch new information if it will create confusion. But one of the things that I believe made me more successful15:15
ubuntouristthan 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
svayeI will read on it more to understand it better15: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
svayewas he the one who wrote15:19
svayeit15:19
ubuntouristand 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
ubuntouristToday, 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
ubuntouristIt "reshaped" my brain, I think. 😉15:23
svayeI just searched for it and I saw something 15:23
ubuntouristIt 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
svayealright15:25
ubuntouristOne more thing: Going back to what you said when we started, about learning to use the operators +, -, *, / and =.15:26
ubuntouristDid the module cover the "shortcut use" of the assignment operator "="?15:27
svayeoperator "=" assigns a value15:27
ubuntouristYou can combine the = with other operators to "shortcut" your typing.15:28
ubuntouristAn example would be:15:28
ubuntouristt = 015:28
ubuntouristfor i n range(10):15:28
ubuntourist    t += 115:29
ubuntouristprint(t)15:29
ubuntouristTry 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
jelknerubuntourist, i'm in class, but i just wanted to say hi!15:33
svayeGood afternoon jelkner 15:33
jelknergood afternoon, svaye 15:34
ubuntouristjelkner, hi. Attendence is a bit thin today... Looks like there was network trouble.15:34
jelknersadly, it happens15:34
jelknerbut your email was a huge help15:34
jelknerbtw, ubuntourist, we need to find a time to catch a meal together15:34
ubuntouristjelkner, we've been talking about Boolean values and truth tables.15:34
jelknerany plans to come to Virginia Square?15:35
jelknerapologies15:35
jelknerdon't mean to interrupt15:35
ubuntouristjelkner, there's got to be one coming up soon.15:35
jelknerlet me know when15:35
jelknerso i can meet you for pizza after15:35
ubuntouristjelkner, that's okay, I'm running out of things to say and was going to call it quits early.15:35
jelknergreat then.15:36
jelknerlet me know the next saturday you're coming to Virginia Square15:36
ubuntouristjelkner, will do15:37
jelknerthanks!15:37
ubuntouristsvaye, So, any questions?15:37
svayeI am clear for now15:38
ubuntouristsvaye, well then, I'll chat with you next time. Bye for today!15:38
svayeHave a nice day Mr Cole15:39
*** ubuntourist has quit (Quit: Leaving)15:39
svayeHave a nice day jelkner 15:39
svayeACTION signs off15: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
scooperGood afternoon Sahnun21:56
*** shmohamud has quit (Remote host closed the connection)21:59
shmohamudgood afternoon Spencer22:05
scooperGood afternoon Sahnun22:05
shmohamudWhat is the output of the following code:22:06
shmohamudprint("My\nname\nis\nBond.", end=" ")22:06
shmohamudprint("James Bond.")22:06
shmohamudRemember you are not allowed to run it in the sandbox22:07
scooperok22:07
scooperwhat name is equal to22:08
scooperis a variable or name is just a string here22:08
scooperI can explain the code 22:10
shmohamudThere's no need to know what name is equal to22:11
shmohamudTo know what's printed. Note that it's a string in there, so name is really just part of a string.22:11
shmohamudScooper 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
scoopereach value will print a on a seporate line22:13
scooperMy22:13
scoopername22:13
shmohamudOk scooper, let's reconnect Monday. Keep practicing on your own and we'll work through more practice problems22:13
scooperOk22:14
scooperyou just save me the time to sleep22:14
scooperthanks Sahnun22:14
shmohamudAlright well sleep well22: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/!