IRC log of #novawebdev for Monday, 2023-05-29

*** shmohamud has quit (Remote host closed the connection)01:37
*** shmohamud has quit (Ping timeout: 480 seconds)02:05
*** shmohamud has quit (Ping timeout: 480 seconds)02:47
*** shmohamud has quit (Ping timeout: 480 seconds)04:02
*** shmohamud has quit (Ping timeout: 480 seconds)04:36
*** shmohamud has quit (Ping timeout: 480 seconds)06:37
*** shmohamud has quit (Read error: Connection reset by peer)08:24
*** shmohamu_ has quit (Ping timeout: 480 seconds)08:32
*** shmohamud has quit (Ping timeout: 480 seconds)10:34
fkoikoiGood morning shmohamud12:33
*** shmohamud has quit (Ping timeout: 480 seconds)12:35
scoopergood morning shmohamud12:36
*** fkoikoi has quit (Remote host closed the connection)12:39
fkoikoiGood morning shmohamud13:01
*** shmohamud has quit (Ping timeout: 480 seconds)13:07
shmohamudglld d\\\13:21
shmohamudgood day13:21
fkoikoigood morning shmohamud13:26
shmohamudgood day fkoikoi13:28
shmohamudis scooper here today?13:28
fkoikoiyes but he went out to buy something13:29
shmohamudthat's fine13:29
shmohamudwould you like to get started or wait for scooper?13:29
fkoikoilet's get started please13:30
shmohamudsounds good13:30
shmohamudwrite me a list of numbers from 0 to 3 using the range function13:31
shmohamudcan you do that?13:31
fkoikoilet me try13:31
shmohamud+113:32
fkoikoimy_list = ["1", "3"]13:40
fkoikoiprint(my_list)13:40
shmohamudthis is good, but it's not using the range function13:43
shmohamudare you familiar with the range and list method?13:44
sysadmin_good morning shmohamud13:47
fkoikoi__my_list = 313:47
fkoikoi__for numbers in range (1, my_list):13:47
fkoikoi__    print(my_list)13:47
shmohamudgood morning sysadmin13:47
sysadmin_hahahah is me Spencer13:47
shmohamudLol I know, you have multiple aliases 13:48
sysadmin_but my nick name is refusing to change that why13:48
shmohamudI should just start saying Spencer :)13:48
shmohamudfkoikoi, another good attempt but I asked you to simply create a list using the range and list methods. What you've shared is iterating through a range13:49
fkoikoi__alright 13:49
sysadmin_superheroes = ["thor", "batman", ["superman", "wonder woman"], ["spider man", "haulk"]]13:49
sysadmin_print(superheroes[3][0])13:49
fkoikoi__let me try again13:50
sysadmin_output is "spider man"13:50
shmohamudwell done spencer!13:50
shmohamudfkokoi, let's see if Spencer can help13:50
*** fkoikoi has quit (Ping timeout: 480 seconds)13:50
*** scooper has quit (Ping timeout: 480 seconds)13:50
shmohamudSpencer, can you generate a list using range and list methods, from 0 to 4.13:51
shmohamudAlso fkoikoi, can you share your homework when you get the chance?13:51
scooperPlese rephrase the question again I done understand...13:52
shmohamudcreate a list [0,1,2,3] using the range and list() methods13:52
shmohamudhave you used the list() method before?13:52
scooperyou mean getting the index in a list???13:53
shmohamudno no, I mean creating a new list13:53
shmohamudI'll demonstrate because I think the question is not clear13:53
shmohamudso, to do this, we can do: new_list = list(range(4))13:54
shmohamudcan you both try that out?13:54
fkoikoi__+113:54
scooper+113:55
shmohamudwhat version of python are you guys running?13:55
scooperIt's done but not displaying anything.......13:55
shmohamudI forgot to add, print(new_list)13:56
scooperversion 3.913:56
shmohamudOk good13:56
shmohamudquestion: what if I want to know the length of a list, what built-in function can we use?13:57
scooperoutput is <class list>13:57
scooperlen13:58
shmohamudI don't know why it showing as <class list> instead of showing the actual list - any idea why Spencer?13:58
shmohamud+1 len is correct. Very useful function.13:58
scooperSo that mean you want to checking the total number of items in a list right???13:59
scooper*check13:59
shmohamudYes, exactly13:59
scooperlet me demonstrate to see if that what you mean14:00
shmohamudOk14:00
scoopervalue = ["Spencer","Freena","Shmohamud","Jeff"]14:01
scoopernewvalue = len(value)14:01
scooperprint(newvalue)14:01
scooperThis program will check the total number of item in a list14:01
shmohamudyes, could you do it without declaring a new variable?14:02
shmohamudwithout declaring newvalue14:02
scoopervalue = len(["Spencer","Freena","Shmohamud","Jeff"])14:03
scooperprint(value)14:03
shmohamudusually we want to keep the list as a list14:03
shmohamudcan you do it without changing the list from a list to an int?14:03
shmohamudCorrect, but I was hoping for a slightly different response14:04
shmohamudfkokoi are you following?14:04
fkoikoi__+114:04
shmohamuddid you complete your homework?14:05
fkoikoi__yes14:05
shmohamud"fkoikoi, write a for loop that loops through a list of names ["freena", "jeff", "spencer", "sahnun"] and prints out "Hello from Monrovia {name}""14:06
scooperyou want me to keep the list constant???14:06
shmohamudyes, keep the list as a list14:06
shmohamudfkoikoi, can you paste your answer here so we can go over the homeowrk14:06
scooperlet me try and see14:06
shmohamud+114:07
fkoikoi__my_team = ("programmers")14:08
fkoikoi__programmers = ["freena", "Jeff", "spencer", "sahnun"]14:08
fkoikoi__for value in programmers:14:08
fkoikoi__    print(f"Hello {value} from Monrovia\n")14:08
shmohamudwell done fkoikoi!14:09
shmohamudwhy did you declare a my_team variable at the top?14:10
fkoikoi__thanks14:13
scooperShmohamud14:13
scooperI though of using split method but it's not working14:13
shmohamudno need for a split14:14
shmohamudvalue = ["Spencer","Freena","Shmohamud","Jeff"]14:14
shmohamudnewvalue = len(value)14:14
shmohamudprint(newvalue)14:14
shmohamudprint(len(value))14:14
shmohamuddoes that make senes?14:15
scooperOoh sorry was not following14:15
scooperplease repeat14:15
shmohamudso you wrote a 3 line program to begin14:15
scooperok I m seeing what you did14:15
shmohamudthen it went to two lines when you took the length of the list directly14:16
shmohamudI kept it at two lines, but I kept value as equal to the list14:16
fkoikoi__I declare my_team a variable because I want to assign is to a value called "programmers"14:16
shmohamuddoes that make sense?14:16
fkoikoi__*it14:17
scooperTalking to me or fkoikoi?14:17
shmohamudyou scooper :)14:17
shmohamudprint(len(value))14:17
shmohamudthat was what I was hoping for 14:17
scooperyes but Why the len is repeated twice???14:17
shmohamudit's not...!14:18
shmohamudvalue = ["Spencer","Freena","Shmohamud","Jeff"]14:18
shmohamudnewvalue = len(value)14:18
shmohamudprint(newvalue)14:18
shmohamud^^ that's the original14:18
shmohamudinstead of creating newvalue, we should just print it on the next line: print(len(value))14:18
shmohamuddoes that make sense?14:19
scooperplease give me two minutes let me analysis the program before responding14:19
shmohamudfkoikoi: why do you assign programmers to a string and where do you plan to use it, since it's not being used in the program14:19
shmohamudOk scooper14:19
shmohamudI'll be right back, going to the restroom14:20
scooperOk 14:22
shmohamudback14:23
scooperThis program is not running14:23
shmohamudwhich program?14:23
scoopervalue = ["Spencer", "Freena", "Shmohamud","Jeff"]14:23
scoopernewvalue = len(value)14:24
scooperprint(newvalue)14:24
scooperprint(len(value)14:24
scooperthis is what you wrote right???14:24
shmohamudyes, excpt remove the print(newvalue)14:24
scoopervalue = ["Spencer", "Freena", "Shmohamud","Jeff"]14:25
scoopernewvalue = len(value)14:25
scooperprint(newvalue)14:25
scooper#print(len(value)14:25
shmohamudwhy did you keep newvalue and print(newvalue) --- please remove them14:26
shmohamudfkoikoi - do you have a response to my question earlier?14:26
fkoikoi__yes14:26
shmohamudplease share14:27
scoopershmohamud14:28
scooperour goal here is to maintain the list right???14:28
shmohamudyes, do not change it to len(value)14:28
shmohamudand to print the length of it on the next line14:28
scoopervalue = ["Spencer", "Freena", "Shmohamud","Jeff"]14:29
fkoikoi__I wanted to used programmers with the if statement but it want giving me error14:29
scoopernewvalue = len(value)14:29
scooper#print(type(newvalue))14:29
scooperprint(type(len(value)))14:29
fkoikoi__something like this14:29
scooperIf we introduce the "type" to know the data type of this program it will still display int14:29
shmohamudscooper, the goal was to keep it shorter to two lines!14:29
shmohamudand when did we ask for the type? 14:29
shmohamudO.O14:29
scooperYou said previously that the program should not change it data type, am I right??14:30
shmohamudfkoikoi - ok, but what's the need to declare a variable programmers if we can just declare the string wherever we need it?14:30
shmohamudAh, true scooper14:30
scooperThat why said I want to analyze the program but responding14:31
shmohamudscooper we're overcomplicating this now I think. Let's take a step back14:31
scooper*before14:31
shmohamudvalue = ["Spencer","Freena","Shmohamud","Jeff"]14:31
shmohamudnewvalue = len(value)14:31
shmohamudprint(newvalue)14:31
shmohamudmy question is, can you combine line 2 and 3 into one line?14:32
shmohamudinstead of declaring newvalue14:32
shmohamudfkoikoi - does my question make sense? I'm not sure how you wanted to use the variable but please share if you had a plan to use it14:34
fkoikoi__okay14:34
scooperI got confuse from this statement of your shmohamud "I kept it at two lines, but I kept value as equal to the list"14:36
fkoikoi__my_teame = "programmers"14:36
fkoikoi__if programmers = ["freena", "Jeff", "spencer", "sahnun"]14:36
fkoikoi__for value in programmers:14:36
fkoikoi__    print(f"Hello {value} from Monrovia\n") 14:36
shmohamudScooper: Ah, that's fair. So, what I mean is if we do: value = len(["Spencer", "Freena", "Shmohamud", "Jeff"])14:37
shmohamudThe result is going to be the length, an Int. I prefer to keep it as a list, as it is.14:38
shmohamudBecause, maybe down the road in the program, we would want to access the list, not just the length of the list14:38
shmohamudDoes that make sense?14:38
scooperYes14:39
shmohamudOk, so do you have the second line for me now? :)14:39
fkoikoi__or should I rewrite the program this way:14:39
fkoikoi__programmers = ["freena", "Jeff", "spencer", "sahnun"]14:39
fkoikoi__for value in programmers:14:39
fkoikoi__    print(f"Hello {value} from Monrovia\n") 14:39
shmohamudFkoikoi - I don't see where you're using the my_teamme variable14:39
shmohamudI think the above makes more sense, because when writing programs, it's best practice to have no unused variables. It takes up space and confuses the reader. 14:40
shmohamudDoes that mek sense fkoikoi?14:40
fkoikoi__yes14:40
shmohamudAwesome, so do you guys know how to concatatenate lists?14:41
shmohamudlist_a = [1,2,3] 14:41
fkoikoi__But I didn't used the variable my_team in the first program14:41
shmohamudlist_b = [4, 5, 6]14:41
scooperlet me give it a try14:41
shmohamudhow do I concatenate (combine) the two lists?14:41
scooperI think it work with the append function right14:42
shmohamudfkoikoi --> exactly14:42
shmohamudscooper -- show me what you're thinking :D14:42
scooperlist_a = [1,2,3]14:44
scooperlist_b = [4,5,6]14:44
scooperlist_a.append(list_b)14:44
scooperprint(list_a)14:44
shmohamudscooper, that works,  but what if I said I want the output to be: [1,2,3,4,5,6] instead of [1,2,3, [4,5,6]]14:45
shmohamudhow would you concatenate the lists?14:46
scooperLet me think small14:46
shmohamud+114:46
*** fkoikoi__ has quit (Remote host closed the connection)14:49
scoopershmohamud14:49
scooperMy thinking ability failed14:50
fkoikoican I try too14:50
scooper+114:50
shmohamudLol, you're fine! This is new material 14:50
shmohamudPlease try fkoikoi14:50
fkoikoilist_a = [1,2,3,4]14:51
fkoikoilist_b = [5,6,7,8]14:51
fkoikoilist_a.extend(list_b)14:51
fkoikoiprint(list_a)14:51
shmohamudwell done fkoikoi!14:51
shmohamudnext question: can you do it without the extend function?14:52
fkoikoilet me try14:52
fkoikoilist_a = [1,2,3,4]14:53
fkoikoilist_b = [5,6,7,8]14:53
fkoikoilist_a.append(list_b)14:53
fkoikoiprint(list_a)14:53
shmohamudthat's what scooper attempted earlier, the issue is it outputs as : [1,2,3,4, [5,6,7,8]]14:54
shmohamudso let me let you guys in on a simple way to do this: 14:54
*** fkoikoi has quit (Remote host closed the connection)14:55
shmohamudcombined_list = list_a + list+b14:55
shmohamudcombined_list = list_a + list_b14:55
scooperooh with the plus operator14:55
shmohamudyes!14:55
shmohamudtry it and let me know how it gpes14:55
scooperlist_a = [1,2,3]14:58
scooperlist_b = [4,5,6]14:58
scooperlist_a.extend(list_b)14:58
scooperprint(list_a)14:58
scoopersorry14:58
scooperlist_a = [1,2,3,4]14:58
scooperlist_b = [4,5,6,7]14:58
scooperjoinit = list_a + list_b14:58
scooperprint(joinit)14:58
shmohamudit prints as expected right scooper?14:59
scooperyes14:59
scooperthe is a question14:59
shmohamudlast topic for the day: slicing!14:59
shmohamudyes scooper?14:59
scooperthis "format" which stand for "f" is also use for concatenation 15:00
*** fkoikoi has quit (Remote host closed the connection)15:00
scooperwhy trying it in another way it render something else15:00
shmohamudyou mean append vs. + operator?15:00
scooperNO15:00
scooperI mean print(f"")15:01
scooperwith the value placed between the double quotation marks15:01
shmohamudlet me test on my system, can you give me an example of a string that prints differently based on whether you use formatted string?15:02
scooperthis is what I mean15:03
scooperlist_a = [1,2,3,4]15:03
scooperlist_b = [4,5,6,7]15:03
scooperjoinit = list_a + list_b15:03
scooper#print(joinit)15:03
scooperprint("{list_a}{list_b}")15:03
scooperlist_a = [1,2,3,4]15:04
scooperlist_b = [4,5,6,7]15:04
scooper#joinit = list_a + list_b15:04
scooper#print(joinit)15:04
scooperprint("{list_a}{list_b}")15:04
shmohamudprint({list_a}{list_b}) is still two separate lists15:06
shmohamudso it would print "[1,2,3,4][5,6,7,8]" right?15:07
scoopersorry it is working15:07
scooperbut not print what was expected15:08
scooperlist_a = [1,2,3,4]15:08
scooperlist_b = [4,5,6,7]15:08
scooper#joinit = list_a + list_b15:08
scooper#print(joinit)15:08
scooperprint(f"{list_a}{list_b}")15:08
shmohamudok, what's unexpected about the output?15:08
scooperIt's printing the previous output I give you first15:09
shmohamudcan you write the unexpected output15:09
scooperNo it find for now Shmohamud15:10
shmohamudOk, so do you guys know how slicing works in Python?15:10
scooperfor me yes15:10
shmohamudfkoikoi?15:11
shmohamudtest_list = [9, 41, 12, 3, 74, 15]15:12
fkoikoino15:12
shmohamudscooper, can you show me a slice that gets [9, 41, 12, 3]15:12
scooperlet me give it a try15:12
shmohamud+115:13
shmohamudfkoikoi, slicing lists is about getting back a chunk of a list15:14
scoopertest_list = [9,41,12,3,74,15]15:15
scooperprint(test_list[0:4])15:15
shmohamudperfect15:15
shmohamuddo you see how that worked fkoikoi? We take a range and it prints all indices up to but not including the end of the range15:16
shmohamudscooper, can you slice [74, 15] please?15:16
scoopertest_list = [9,41,12,3,74,15]15:17
scooperprint(test_list[4:])15:17
shmohamudawesome!15:18
shmohamudalright well you guys we've had a great session. Any questions before we call it a day?15:18
scooperYes15:18
shmohamudOk, let's hear it15:18
scooperthese two are use for concatenation in python "f" and "+" why "f" didn't work as expected in the previous example give. Second when is it appropriate to use either of the two??15:20
scooper*secondly15:20
shmohamud"f" isn't for concatenating strings, it's for formatting string literals15:21
shmohamud+ and "append" are used to concatenate strings15:21
shmohamudI mean, extend ****15:21
shmohamudDoes that make sense?15:22
scooperYes15:22
shmohamudany more good questions before we call it a day?15:23
scooperso when is it appreciate to use either of the two15:23
shmohamudcheck this out for more on formatted string literals: https://docs.python.org/3/tutorial/inputoutput.html#tut-f-strings15:23
scooperThanks15:23
shmohamudYou're welcome. They're not interchangeable, there's no concatenating using "f". If you want a formatted string, use "f" if you want to concatenate lists, use the "+" operator15:24
shmohamudfkoikoi, any questions before we call it a day?15:25
fkoikoiI saw the examples about slicing lists but I didn't really get a clear understanding of it 15:25
fkoikoiwould you make me understand please15:25
shmohamudOk, the best way to is to practice fkoikoi. 15:26
shmohamudFor homework, take this list [9,41,12,3,74,15]15:26
shmohamudand take slices of [9, 41], [9, 41, 12], [3,74], and [3, 74,15]15:27
shmohamudFor now, scooper, can you explain how slicing works?15:27
scooperYes15:27
scooperfkoikoi15:27
scooperaccording to python list have an index value15:28
scooperwhich always begins with a zero index15:28
scooperlooking at the list = [9,41,........] example that was given15:28
scooperit has an index of 6 but when counting we will start counting it from zero that mean our numeric value here is 5 15:30
scooperTo get the slice of a value in a list we use the the name of the variable follow by this [ ]15:31
*** fkoikoi has quit (Remote host closed the connection)15:31
scooperin this [ ] you indicate where you want to start the counting from example. I want to start counting from zero15:32
scooperand end on 215:32
scooperThat mean from zero index print 9 and 41, not do not include 1215:33
shmohamudfkoikoi, are you following? Spencer is doing a great job so far15:33
fkoikoisure15:34
scooperexample  will be print(the name of the variable ["in here indicate where you want your counting to start. and include a colon between the start and ending point]15:35
scooperdoes that make sense???15:35
fkoikoiyes scooper15:35
shmohamudOk fkoikoi, did you save tonight's homework?15:36
fkoikoiyes15:36
shmohamudScooper I have homework for you too15:36
scooperI almost ask for it15:36
shmohamudHahaha15:36
shmohamudcan you open this link? https://www.w3schools.com/python/python_lists_methods.asp15:37
scooperI just did15:37
shmohamudI want you to learn two new list methods, and come with examples to teach them to me and fkoikoi tomorrow. I recommend starting with sort() and reverse(). Have you learned those already?15:38
fkoikoino15:38
scooperYes I did sort before15:39
shmohamudOk, have you done pop()?15:39
scooperand reverse with you few days ago15:39
shmohamudOh, I remember now15:39
shmohamudHave you learned all the list methods on the list? Check and let me know now15:39
shmohamudIf you have, I have something else I'll give you15:39
scooperNo 15:39
shmohamudWhich ones will you study and share on tomorrow?15:40
scooperAll15:40
shmohamudok, but can you choose two to come with examples on?15:40
scooperyou choose for me15:40
shmohamudhave you used all of them already?15:41
scooperNo but I m going to learn base on your instruction15:41
shmohamudOk, can you choose two now? Two is alot, I want you to learn them well and test in many different scenarios15:41
scooperok15:41
scooperlet me see15:41
shmohamudI don't know which ones you haven't used so I want you to choose15:42
*** fkoikoi has quit (Remote host closed the connection)15:42
shmohamud+115:42
scooperI will like to try reverse and insert... since reverse did not work this gone time15:43
shmohamudOk, I'm expecting two examples you can explain tomorrow. One for reverse, one for insert :)15:43
shmohamudSound good?15:43
scooperYes Programmer15:43
shmohamudHehe awesome. Any final questions before we call it a day?15:44
shmohamudYou guys are doing great, by the way :)15:44
scooperThanks15:44
fkoikoithqnks15:44
fkoikoithanks15:44
shmohamuddo you guys prefer we meet earlier, 9AM my time instead of 10am my time?15:46
scooperIf it's ok for you15:46
shmohamudIt's OK for me, so let's start doing 9AM my time :)15:47
fkoikoiokay15:47
scooperOK Shmohamud15:47
shmohamudSee you tomorrow at 9AM, have a wonderful evening and good luck with the homework.15:47
scooperOk15:47
scooperThanks for always be there15:47
fkoikoialright15:47
*** scooper has quit (Quit: Leaving)15:48
shmohamudyou're welcome15:48
*** shmohamud has quit (Remote host closed the connection)15:48
*** fkoikoi has quit (Quit: Leaving)15:48
*** shmohamud has quit (Remote host closed the connection)18:06
*** shmohamud has quit (Remote host closed the connection)18:59

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