IRC log of #novawebdev for Tuesday, 2023-05-30

*** scooper has quit (Remote host closed the connection)12:30
scoopergood morning Aaron12:32
scooperGood morning shmohamud12:47
scooperhow was your night???12:47
shmohamudgood day scooper12:49
shmohamudmy night was relaxing, how about your evening?12:49
scoopernot bad... 12:50
shmohamudcool :)12:50
shmohamudhow was learning about list methods?12:51
scooperfind but count nearly confuse me, but I grab what it was doing later....12:51
scooper*fine12:51
shmohamudI thought you were looking into insert and reverse, you went further?12:52
scooperI did  reverse, sort and count12:52
shmohamudah, okay cool12:52
shmohamudnice job doing extra12:53
scooperbut if choose insert too it's not a problem I can still do it12:53
shmohamudfkoikoi good day12:53
shmohamudthat's fine scooper, I asked you to choose two and it sounds like you did three so we're all good! If you want you can explain insert too, though.12:54
fkoikoigood morning shmohamud12:54
shmohamudHappy Tuesday guys12:54
shmohamudSo, let's dive in! Fkoikoi, did you complete the homework?12:55
scooperSame from our end shmohamud12:55
fkoikoiyes, i did12:56
shmohamudplease share the results12:57
shmohamudnext, we will have scooper teach us about some list methods12:57
scooperOK12:58
scooperThanks for giving me that opportunity12:58
shmohamudIt's a great way for all of us to learn. You're welcome.12:58
shmohamudfkoikoi?13:01
fkoikoiyes13:01
shmohamudcan you please share the homework answers with us?13:01
fkoikoitest_list = [9,41,12,3,74,15]13:03
fkoikoiprint(test_list[0:2])13:03
fkoikoitest_list = [9,41,12,3,74,15]13:03
fkoikoiprint(test_list[0:3])13:03
fkoikoitest_list = [9,41,12,3,74,15]13:03
fkoikoiprint(test_list[3:-1])13:03
shmohamudscooper, does it answer this: and take slices of [9, 41], [9, 41, 12], [3,74], and [3, 74,15]13:05
shmohamud?13:05
scooperThe last question has an error13:06
scooperFirstly what is she printing?? 13:06
shmohamud[9, 41]13:07
shmohamud[9, 41, 12]13:07
shmohamud[3, 74]13:07
shmohamudShe's printing this ^^13:07
shmohamudit's missing one answer, [3, 74, 15]13:08
scooperthe first line is correct13:08
scoopersecond is correct too13:09
shmohamudyup13:09
scooperthe last is not correct13:09
shmohamudare you sure scooper? I ran it on my machine and it gave me the correct output..13:09
scooperyes13:10
scooper3:513:10
scooperto get 3 and 74 she need to use this 3:513:10
shmohamudcan she use a negative index?13:11
shmohamudyou're correct, 3:5 works, but as often is the case in programming, there is more than one way to do it!13:11
scooperyes13:11
scoopernegative will start checking from the last value13:11
shmohamudyes13:12
scooperbut it's advisable to use mix value13:12
scooperit might complicate thing something....13:12
shmohamudI think you're right, it's advisable to avoid negative indices because it's less readable. Readability is important. However, it still works and answers the original question.13:13
fkoikoiso I should use this instead13:14
fkoikoitest_list = [9,41,12,3,74,15]13:14
fkoikoiprint(test_list[0:2])13:14
fkoikoitest_list = [9,41,12,3,74,15]13:14
fkoikoiprint(test_list[0:3])13:14
fkoikoitest_list = [9,41,12,3,74,15]13:14
fkoikoiprint(test_list[3:-1])13:14
fkoikoitest_list = [9,41,12,3,74,15]13:14
fkoikoiprint(test_list[3:6])13:14
shmohamudgreat job fkoikoi, A+ on the homework13:15
shmohamudOk scooper, ready to teach us about list methods?13:16
scooperyes Programmer13:16
scoopersuperheroes = ["thor", "batman", ["superman", "wonder woman"], ["spider man", "haulk"]]13:16
scooperprint(superheroes[3][0])13:16
scoopernew_list = list(range(4))13:16
scooperprint(list)13:16
scoopervalue = ["Spencer","Freena","Shmohamud","Jeff"]13:16
scoopernewvalue = len(value)13:16
scooperprint(newvalue)13:16
scoopervalue = ["Spencer", "Freena", "Shmohamud","Jeff"]13:16
scoopernewvalue = len(value)13:16
jelknerThat made my day, as soon I login, I see A+ on homework! ;-)13:16
scooper#print(type(newvalue))13:16
scooperprint(type(len(value)))13:16
scooperlist_a = [1,2,3]13:16
scooperlist_b = [4,5,6]13:16
scooperlist_a.extend(list_b)13:16
scooperprint(newlist)13:16
scooperlist_a = [1,2,3]13:16
scooperlist_b = [4,5,6]13:16
scooperlist_a.extend(list_b)13:16
scooperprint(list_a)13:16
scooperlist_a = [1,2,3,4]13:17
scooperlist_b = [4,5,6,7]13:17
scooper#joinit = list_a + list_b13:17
*** fkoikoi has quit (Remote host closed the connection)13:17
scooper#print(joinit)13:17
scooperprint(f"{list_a} + {list_b}")13:17
scoopertest_list = [9,41,12,3,74,15]13:17
scooperprint(test_list[4:])13:17
scooperfruit = ["apple", "banana","cherry"]13:17
scooperfruit.insert(2, "orange")13:17
scooperprint(fruit)13:17
scooperfruit.reverse()13:17
scooperprint(fruit)13:17
scooperfruit.sort()13:17
scooperprint(fruit)13:17
scooperappend() Adds an element at the end of the list13:17
scooperclear() Removes all the elements from the list13:17
scoopercopy() Returns a copy of the list13:17
scoopercount() Returns the number of elements with the specified value13:17
scooperextend() Add the elements of a list ( or any iteration), to the end of the current13:17
scooperarrangingNumber = [0,9,8,7,11,13,15,14,12,19,16,20,6,5,4,3,2,1,3,3,4,4,5,5,5,5,5]13:17
scooperprint(arrangingNumber,"\n")13:17
scooperarrangingNumber.sort()13:17
scooperprint(arrangingNumber, "\n")13:17
scooperarrangingNumber.reverse()13:17
scooperprint(arrangingNumber, "\n")13:17
scooperprint(arrangingNumber.count(5))13:17
scooper#Describe how you would develop object-oriented features of Java for the Quiz program developed in the Programming Assignments. In particular, describe how the program could use each of the following: class variables, instance variables, inheritance, polymorphism, abstract classes, "this", "super", interfaces, and event listeners.13:17
scooperI m sorry13:18
scooperarrangingNumber = [0,9,8,7,11,13,15,14,12,19,16,20,6,5,4,3,2,1,3,3,4,4,5,5,5,5,5]13:18
scooperprint(arrangingNumber,"\n")13:18
scooperarrangingNumber.sort()13:18
scooperprint(arrangingNumber, "\n")13:18
scooperarrangingNumber.reverse()13:18
scooperprint(arrangingNumber, "\n")13:18
scooperprint(arrangingNumber.count(5))13:18
scooperI m presenting a three of list method in Python today13:18
scooperI m presenting on three of list method in Python today13:18
scooperwhich include: reverse, count and sort13:18
scooperI you still there shmohamud??13:18
shmohamudYes13:19
shmohamudthat was a lot of text! Let'd dive in13:19
scooperFirstly I will begin with the challenging one I was face with: count13:19
scoopercount is a Python method that is use to check the amount of repeating item in a list13:20
shmohamudfkoikoi be sure to pay attention13:20
scooper example: "a","b", "c", "a", "a", "a", "a"13:21
fkoikoiokay13:21
shmohamudscooper is that a list or are they floating strings?13:22
scooperthat is not a list13:22
scooperjust illustrating something13:22
shmohamudAh, ok13:22
scooperbut I m bring a list in soon13:22
shmohamud+113:23
scooperif I use the python list method like this numberofletter = ["a","a","a","c", "d","e"] numberofletter.count("a") print(numberofletter)13:24
scooperthis example will print an integer value of 3....13:24
scoopertelling the end user that the letter a appear three time in a program13:24
shmohamudwould that print integer value or the original list?13:24
scooperinteger value13:25
shmohamudprint(numberofletter.count("a")) 13:25
shmohamudis that what you implied in the code above? 13:25
tmickelsonhello fkoikoi, scooper, and shmohamud 13:26
shmohamudmorning tmickelson13:26
shmohamudscooper please continue, I will let you finish before nitpicking at the details :)13:26
fkoikoihi tmickelson13:26
scooperletter = ["a","a", "a","b", "c", "d"]13:28
scooperprint(letter.count("a"))13:28
scooperif you this code on you computer you will get an integer value of three13:28
scooper*run13:28
shmohamudgot it, looks great. You're doing great please continue13:28
scoopernext is reverse in Python13:28
scooperreverse is a list method in python that print out information reverse/backward position13:29
scooperexample will13:30
scooperreversingLetter = ["a","b","c","d","e","f","g","h"]13:31
scooperreversingLetter.reverse()13:31
scooperprint(reversingLetter)13:31
scooperreverse method will change the arrangement of this variable called reversingLetter13:32
scooperinstead of it being a,b,c,d... during the final output it will display ['h', 'g', 'f', 'e', 'd', 'c', 'b', 'a']13:33
shmohamudlooks great!13:33
shmohamudwell done, scooper. Are you going to demo insert as well?13:33
scooperNo problem I will give it a try13:33
scoopernext is sort13:34
shmohamudfkoikoi please ask any questions you have, too. I'm going to be right back, 2 minutes, restroom break.13:34
fkoikoi +113:34
*** shmohamud has quit (Remote host closed the connection)13:38
shmohamudback13:38
shmohamudOk, ready when you are scooper13:39
scooperI m waiting for fkoikor question before I proceed13:39
shmohamudfkoikoi - any questions?13:39
fkoikoiI don't have any questions for now13:39
scooperok13:40
scoopernext is sort13:40
scoopersort in python is a list method arrange items that are in a list in order13:41
scooperthat order could be alphebetically or numerical order13:41
scooperexample will be13:41
scooperarrangingNumber = [0,9,8,7,11,13,15,14,12,19,16,20,6,5,4,3,2,1,3,3,4,4,5,5,5,5,5]13:43
scooperarrangingNumber.sort()13:43
scooperprint(arrangingNumber)13:43
scooperlooking at this variable called arrangingNumber it has value starting with o and end with 513:43
*** fkoikoi has quit (Remote host closed the connection)13:44
scooperWhen the sort method is apply to this variable the finally output will change by arranging itself in order beginning with the lower number to the highest number13:45
scooperBefore I climax 13:45
scooperlet us take to consideration two method in python13:46
scooperlen and count13:46
scooperThey are almost serve the same purpose but I absolutely different13:47
scooperThey almost serve the same purpose but I absolutely different13:47
fkoikoiscooper13:48
scooper+113:48
fkoikoiwhat is the function of the letter "n"?13:48
scooperanytime you see a value with a opening and closing quote it is a string13:49
scooperbefore I ask13:50
scooperwhere did you find the letter "n" from in the program??13:50
fkoikoiin the print statement13:50
scoopercan you please paste it here13:51
fkoikoiprint(arrangingNumber, "\n")13:51
scooperoh13:51
scooperthe "\n" represent a new line in python13:52
scooperI m telling my program to print each output on a new line to give the user space so that they can read clearly13:53
scooperis that understood??13:53
jelknerURL for the book: https://openbookproject.net/books/bpp4awd/13:53
scooperThanks Jeff13:53
jelknerGit repo: https://codeberg.org/OpenBookProject/bpp4awd13:54
scooperany question before I climax???13:54
fkoikoithanks spencer13:54
shmohamudno questions, so far so good.13:54
scoopernext is insert13:54
jelknerBell rings, jelkner signs off for now...13:59
scooperarrangingLetter = ["Spencer","Jeff","Freena"]13:59
scooperprint(arrangingLetter)13:59
scooperarrangingLetter.insert(1, "Shmohamud")13:59
scooperprint(arrangingLetter)13:59
*** jelkner has quit (Quit: Leaving)13:59
scooperok Jeff13:59
scooperinsert is a list method in python13:59
scooperthat is use to inject an item in a list base on it index position14:00
scooperSo if you run the program I just paste in here14:01
scooperit a first output it will print: Spencer, Jeff and Freena14:01
scooperduring the second run after the method insert has been invoke on the variable: arrangingLetter the index position of Jeff which is one 14:02
*** tmickelson has quit (Read error: Connection reset by peer)14:02
*** fkoikoi has quit (Remote host closed the connection)14:03
scooperwill be replace with Shmohamud during the second output and the program will display: Spencer,Shmohamud, Jeff and Freena14:03
scooperwhy this happen is because 14:03
scooperis because Jeff index position in the previous list was one14:04
scooperany question14:04
shmohamudawesome explanation so far.14:05
shmohamudno questions from me14:05
scooperIf no question for me I have a question here shmohamud14:06
shmohamudyes14:06
scooperwe use index number with insert to add another item to our list right??14:07
shmohamudyes, just as you explained it replaces whatever was at that index and pushes the original back one14:08
scooperIf so why insert do accept more them one argument as an index number and value14:09
scooperexample14:09
scooperarrangingLetter = ["Spencer","Jeff","Freena"]14:09
scooperprint(arrangingLetter)14:09
scooperarrangingLetter.insert(1,2, "Shmohamud", "Cooper")14:09
scooperprint(arrangingLetter)14:09
shmohamudthis error gets thrown when I try that: TypeError: insert expected 2 arguments, got 414:11
scooperThat is what I m talking about??14:12
shmohamudinsert accepts two arguments, the first is the position to insert, the second is the element14:12
scooperthat mean insert don't support two argument and two element at once right???14:13
shmohamudexactly14:13
shmohamudit only accepts two arguments, position and element14:13
shmohamudok guys, I think we've had a good session today. Any questions before we give homework and call it a day?14:14
scooperThanks I was making mistakes on purpose to some future problem just in case I encounter this in the near future14:14
shmohamud+114:15
fkoikoithanks scooper for such a brilliant presentation14:18
shmohamudok, if there are no questions, the homework is the create a python dictionary with 3 key-value pairs. Then, write a for loop that prints out all the values in the dict.14:18
fkoikoiis it for me or spencer?14:19
shmohamudfor both of you. fkoikoi, you can use the internet to research dicts, right?14:19
fkoikoi+114:19
shmohamudGood. Both of you should do the same assignment, but I expect different dicts from each of you. Feel free to collaborate14:20
shmohamudAny questions before we log off for the day?14:20
fkoikoiI don't have any question14:21
shmohamudscooper: ?14:22
scooperI m coming14:22
scooperWhen List is important in program???14:22
shmohamudit's important all the time. Imagine you're working on a web application. The user has a list of tweets ["tweet1", "tweet2", "tweet3", "tweet4"]14:23
shmohamudwe would loop through the list of tweets and display them in order on the homepage14:23
shmohamudOr if we're doing data science and we're given a list of grades. How do we find the average? We loop through the list adding together all the grades and divide by the length of the list.14:24
shmohamudThe two most common data structures in programming are lists and dicts. You will make a request to a database, and then you'll get back a data structure shaped like a list [] or a dict {} almost every time14:25
shmohamuddoes that make sense?14:25
scoopergetting it gradually14:25
shmohamudDo you use Google Chrome scooper?14:26
shmohamudFor internet browsing14:26
scooper+114:26
shmohamudDo you know how to access developer tools?14:26
scooperboth firebox and Chrome on a regulars basis14:26
scooper+114:26
shmohamudCan you open developer tools, then click the "Network" tab?14:26
scooperok14:27
shmohamudIs network tab open?14:27
scooperI m there14:28
shmohamudDo you see where it says "Fetch/XHR"?14:28
*** fkoikoi has quit (Remote host closed the connection)14:28
shmohamudunder filters14:28
scooper+114:28
shmohamudclick on that14:28
shmohamudthis is all the requests to servers that your machine is making while you browse the internet14:29
scooperI just did14:29
shmohamudCan you go to Facebook or Twitter?14:29
scooperok14:29
shmohamudDo you see any Fetch/XHR Requests in the list?14:29
scooperI m seeing14:29
shmohamudNow, click on one of them14:30
scooper20ms, 40ms, 60ms, 80ms 10ms14:30
scooper100ms14:30
shmohamudOk, now click on one. Do you see the preview tab?14:30
scooperYou mean Fetch/XHR14:32
*** fkoikoi has quit (Remote host closed the connection)14:32
shmohamudYes14:32
scooperIf I click14:33
scooper20ms14:33
scooperit didn't change14:33
scooperbut rather remind the same14:33
shmohamuddo you see the preview tab?14:34
scooperBut after Fetch/XHR I m seeing: JS, CSSS IMAGE MEDIA, ETC14:34
shmohamudthat's ok14:34
shmohamudI want to show you the data structures that are being sent to your machine. However, you have to click "Preview" or "Response" to see the details. Do you see "Preview" or "Response" tabs?14:35
shmohamudfkoikoi, if possible please open Google Developer Tools as well. And try to find the "Preview" tab to see the Lists and Dicts that are being sent to your machine.14:36
scooperIn the Network session14:36
scooperno14:36
shmohamudFkoikoi - go to the "Network" tab first and then click "Fetch/XHR"14:37
shmohamudscooper, can you try reloading the page you're using devtools on?14:37
scooperShmohamud14:38
shmohamuddo you see a list or requests under the "name" section?14:38
shmohamudlist of requests*14:38
scooperI m being called by supe can we cut it a day today14:38
shmohamudYes, we can.14:39
scooperplease 14:39
shmohamudExplore devtools for homework too :) see you tomorrow14:39
*** fkoikoi has quit (Remote host closed the connection)14:39
fkoikoiSpencer went to the sup office14:41
*** fkoikoi has quit (Remote host closed the connection)14:41
*** scooper has quit (Remote host closed the connection)14:42
*** shmohamud has quit (Remote host closed the connection)14:43
*** fkoikoi_ has quit (None)14:44
*** fkoikoi has quit (None)14:44
*** sysadmin has quit (Ping timeout: 480 seconds)15:02
*** shmohamud has quit (Ping timeout: 480 seconds)15:05
*** sysadmin_ has quit (Quit: Leaving)15:16
*** shmohamud has quit (Remote host closed the connection)16:13

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!