IRC log of #novawebdev for Wednesday, 2023-05-17

*** shmohamud has quit (Ping timeout: 480 seconds)04:54
*** scooper has quit (Ping timeout: 480 seconds)11:22
*** sysadmin has quit (Ping timeout: 480 seconds)11:31
*** sysadmin_ has quit (Read error: Connection reset by peer)11:31
*** sysadmin has quit (Ping timeout: 480 seconds)11:41
*** sysadmin_ has quit (Read error: Connection reset by peer)12:53
shmohamudGood day Spencer13:05
*** shmohamud has quit (Remote host closed the connection)13:09
*** sysadmin__ has quit (Quit: Leaving)13:14
jelknerhello scooper and fkoikoi 13:24
scooperGood morning Jeff13:25
jelknertmickelson has to retate a Spanish quiz, so he won't be here today13:25
fkoikoiGood morning Jeff13:25
scooperOK Jeff13:25
jelknerGood day, fkoikoi 13:25
jelkneri read over the log from yesterday13:25
scooperWe will await shmohamud13:26
jelknershmohamud is an awesome tutor!13:26
scooperhe promised to assist use with python13:26
jelkneri can help with that too13:26
scooperbefore moving to javascript that what I guess13:27
scooperIf you can what are your available time to help us?13:27
jelkneryes, don't confuse things13:27
jelkneryour first programming language is hard to learn13:27
jelknerthe 2nd one is *much* easier13:28
jelknerand after awhile, you can learn a new one in a short time13:28
jelknersince they all operate on the same computer, they all do fundamentally the same thing13:28
jelknerbut in the beginning, trying to learn two at once is very confusing13:28
jelknerand Python is your best choice for a 1st language13:29
jelknerdo you have any questions i can answer now?13:29
scooperThat is why I m really struggling with Java.... 13:30
jelkneryes, i understand13:30
jelkneryou have no choice, since you're taking a class13:30
jelkneri can help with that too13:30
jelknerwhat chapter are you reading now?13:30
jelknersince i have the book, i could look through it13:30
scooperChapter 5 13:30
jelknerscooper, do you have a namecheap account yet?13:30
scooperI will do it today Jeff13:31
jelknerwe need to transfer the mcssliberia.org domain to you13:31
scooperI really busy with tmickelson and shomamud these few days13:31
scooperthat why13:31
scooperI advise you ask me a python question to know how far my understand is in python13:32
scooper*understanding 13:33
jelknerscooper, that's not really the best approach13:36
jelknerthere are *so many* python questions13:36
scooperOK13:36
scooperthis is what I have cover so far in the python book13:37
jelknerand learning programming languages, since they are formal languages that express computations, is more like learning math then it is like learning French13:37
jelkneryou need to learn some things before you learn others13:37
scoopervariable, datatype, condition, loop13:37
jelknerwhat is a datatype?13:37
scooperok13:38
scooperDatatype is particular kind of data that belong to a certain group in python or programming13:38
jelkneryes, except that is a bit circular13:39
jelknerit's like saying "a datatype is a type of data"13:39
jelkneryes, but what does that mean? ;-)13:39
jelknerit is hard to define datatype13:39
jelknerbecause the idea is pretty foundational13:40
scooperIt mean it defined by the kind of information it except13:40
scooperaccept13:40
jelknerbut a data type is a set of values, and the operations that can be performed on those values13:40
jelknergive me some examples of datatypes in python.13:41
scoopersome example of data in python are13:41
scooperwhole number13:41
scooperloat number13:41
scooperstring13:41
scooperfloat number13:41
jelknerso positive and negative whole numbers in python are called int13:42
scoopereven List, dictionary tuple etc13:42
scooperare example of data type in python13:42
jelknernumbers with both a whole number part and a fractional part are called float13:42
jelkneryou're missing one really important type13:42
jelknerscooper, do you have a python shell running?13:43
scooperI can run it if you want me to13:43
jelkneri do want you to13:43
scooperyes I just did13:44
jelkneryou should never try learning python without having python around!13:44
jelknerso you can "ask python" what type a given value has13:44
jelknerfor example:13:44
jelknertype("Hello, Spencer!")13:44
jelknertry it13:44
jelknerwhat do you get?13:44
scooperit is a string data type13:44
jelkneryes, and the python REPL will respond with:13:45
jelkner<class 'str'>13:45
jelkneryes?13:45
jelkneryes, scooper?13:46
jelknerplease confirm13:46
scooperyes13:46
jelknergreat, now try:13:46
jelknertype(42)13:46
scooper<class 'str'>13:46
scooperthis is an int13:47
scooperlet try first13:47
jelkneryup13:47
scooper<class 'int'>13:47
jelkner+113:47
jelknerstarting with str and int is good13:47
scooperJeff13:48
jelknerbecause we can use that to dig in a bit deeper into datatypes13:48
jelknertype("42")13:48
scooperwhat when you use double quotes on integer it say it's string??13:48
jelknerexactly13:48
jelkner"42" is *not* a number, it's a string!13:49
jelknera string is a sequence of characters13:49
scooper>>> type("42")13:49
scooper<class 'str'>13:49
scooper>>> 13:49
jelknerthings that can be typed on a keyboard13:49
jelkner"4" is a character13:49
jelknerit is not a number13:49
jelknerthough python knows how to convert it into a number13:50
jelknertry:13:50
jelknerint("42")13:50
scooper>>> int("42")13:50
scooper4213:50
scooper>>> 13:50
jelkneryup, no quotes anymore13:50
jelknerand if you do:13:50
jelknern = int("42")13:50
jelknertype(n)13:50
jelkneryou'll get:13:51
jelkner<class int>13:51
jelkner<class 'int'>13:51
jelknergoing the other way13:51
scooper>>> n = int("42")13:51
scooper>>> type(n)13:51
scooper<class 'int'>13:51
scooper>>> 13:51
jelknertype(str(42))13:51
jelkner<class 'str'>13:51
jelknerbut if we try:13:52
scooper>>> type(str(42))13:52
scooper<class 'str'>13:52
scooper>>> 13:52
jelknerint("cheese")13:52
jelknerwe get a traceback13:52
jelknerending with13:52
jelknerValueError: invalid literal for int() with base 10: 'cheese'13:52
scooper>>> int("cheese")13:53
scooperTraceback (most recent call last):13:53
scooper  File "<stdin>", line 1, in <module>13:53
scooperValueError: invalid literal for int() with base 10: 'cheese'13:53
scooper>>> 13:53
jelknerpython doesn't know how to convert 'cheese' into a number ;-)13:53
jelkneri don't either13:53
jelknernow, what is a variable?13:54
scooperIn Python a variable is a memory location that store information13:54
jelknersort of13:54
jelknerit is better in python to think at a higher level of abstraction13:55
jelknera variable is "a name that refers to a value"13:55
jelknerscooper, i only have 5 minutes left13:55
jelknerhopefully Sahnun will show up to continue13:55
scooperThanks Jeff13:56
jelknerwhat book are you using to learn python?13:56
scooperPython for everybody 13:56
jelknerWonderful!13:56
jelknerso where are you in the book?13:57
jelknerif we use the book as our guide, i can help with questions and things13:57
jelknersince i will be able to choose questions appropriate for where you are in the text13:57
jelknerwe need to make this "tutoring"13:58
jelknerwhich means:13:58
scooperString13:58
jelkner1. *You* are responsible for driving the process and setting the pace13:58
jelknershmohamud and jelkner are responsible for *helping* you13:58
scooperwelcome shmohamud13:59
jelknerby answering questions and providing more examples to help make Dr. Chuck's presentation understandable13:59
jelknershmohamud, i looked at the logs from yesterday13:59
jelkneryou are an *awesome* tutor!13:59
jelknerok, bell rang, i need to go14:00
jelknershmohamud, let's tag team on this14:00
jelknerand use Python for Everybody as our guide14:00
jelknerso we can switch back and forth and remain relatively consistent14:00
jelknermake sense?14:00
jelknerscooper, see you tomorrow at the same time14:01
jelknerACTION logs off14:01
*** jelkner has quit (Quit: Leaving)14:01
*** shmohamud has quit (Ping timeout: 480 seconds)14:06
scooperGood morning shmohamud are you still there???14:06
fkoikoiGood morning shmohamud14:23
shmohamudGood morning Fkoikoi15:08
fkoikoiHow are you shmohamud?15:09
shmohamudGood, how are you?15:09
fkoikoiI'm fine15:09
shmohamudLet's have a quick session today15:09
shmohamudSound good?15:10
fkoikoialright15:10
shmohamudok, so, loops15:10
shmohamudCan you write me a for loop that prints out every number betweeen 1 and 100?15:10
scoopergood morning shmohamud15:11
shmohamudgood morning Spencer15:11
shmohamudspencer, do you know how to write a function in python?15:12
scooperyes15:12
shmohamudcan you write me a function that takes in a name parameter, and returns me the name capitalized?15:12
shmohamudprints the name capitalized*15:12
shmohamudcall it print_capitalized15:13
scooperlet me give it a try15:13
shmohamudok. Fkoikoi, are you working on the loop?15:13
scoopershould the function be called print_capitalized?15:13
shmohamudYes15:13
scooperok15:13
shmohamudfkoikoi?15:15
fkoikoiyes15:15
fkoikoiI'm working on it15:16
shmohamudok good15:16
fkoikoivalue = 10015:19
fkoikoifor num in range (2, value):15:19
fkoikoi    print (num)15:19
shmohamudGood. Now what if I asked you to change the code so that it includes 1 and 100 too 15:20
shmohamudcould you show me what it would look like?15:21
fkoikoiyes15:22
fkoikoivalue = 10015:24
fkoikoifor num in  range (1, value):15:24
fkoikoi    print (num)15:24
scoopershmohamud15:24
scoopershould the program allow user input15:24
shmohamudalmost fkoikoi. Does 100 print out or does it stop at 99?15:24
shmohamudScooper, it shouldn't. 15:25
scooperok15:25
fkoikoiit stop to 9915:25
shmohamudI will make that clear if that's the case. I just want it to print any string it recieves capitalized.15:25
shmohamudfkoikoi - change it so that 100 gets printed too. There is more than 1 way to do it.15:26
scooperdef print_capitalized(user_input):15:30
scooper    user = "Spencer"15:30
scooper    return (upper(user))15:30
scooperprint_capitalized(user_input)15:30
shmohamudScooper, almost! First line is perfect15:30
shmohamudWhy have you defined a variable, user, inside the function?15:31
scooperto store the value "SPener15:31
shmohamudAnd also - remember I asked you to print it, not to return 15:31
shmohamudNo need to store it, we have the variable from the user_input. Does that make sense15:31
fkoikoivalue = 10115:32
fkoikoifor num in range (1, value):15:32
fkoikoi    print (num)15:32
fkoikoi    15:32
scooperuser_input is serving as a parameter15:32
shmohamudGreat job Fkoikoi, that's what I was looking for!15:32
fkoikoithanks shmohamud15:32
shmohamudyes it is, but when you call the function, that's when you add "spencer" to it15:32
scooperand when the function is call it take an argument of the value in the parenthesis15:32
shmohamudYes, it does. That's why when you call it, it should be "print_capitalized("spencer")15:33
shmohamudAnd I also noticed you're using Upper. This works for the question I asked, because it's capitalized, but what if I only want the first letter capitalized?15:34
shmohamudCan you rewrite the function with (1) not creating a user variable (2) using Python's capitalize function and (3) printing the result rather than return it?15:35
scooperok let me give it a try15:35
shmohamudfkoikoi, do you know how to write functions in python?15:35
fkoikoihmm, except I read on it 15:37
shmohamudok, can you read this: https://www.w3schools.com/python/python_functions.asp15:37
shmohamudAfter that, write me a function that prints out "Hello from Monrovia"15:38
scoopershmohamud 15:39
scooperthere is an error will my function15:39
shmohamudwhat's the error?15:39
scooperName Error15:39
shmohamudshow me the code please15:39
scooperthe value are placed in the argument is causing problem15:40
shmohamudyou shouldn't call it with anything but a string "spencer" or "sahnun"15:40
shmohamudis that the issue?15:40
fkoikoiprint ("Hello from Monrovia")15:41
scooperdef print_capitalized(user_input):15:41
scooper    15:41
scooper    print(user_input)15:41
scooperprint_capitalized("Spencer");15:41
shmohamudyes fkoikoi. Now, put that in a function called "hello_from_monrovia"15:41
scooperOK I found the error15:41
shmohamudThat function is perfect except one thing, where is the capitalization happening?15:42
scooperWhen I was calling the function I didn't indicate the string in quotation15:42
shmohamudNice work15:42
shmohamudperfect, good catch.15:42
fkoikoiprint ("Hello_from Monrovia")15:42
shmohamudfkoikoi I mean you should define the function like this:15:42
shmohamuddef hello_from_monrovia:15:43
fkoikoiokay15:43
shmohamudprint("Hello From Monrovia")15:43
shmohamudthen you can call the function15:43
shmohamudhello_from_monrovia() and it will print out15:43
scoopermy program say upper is not defined15:45
scooperdef print_capitalized(user_input):15:45
scooper    15:45
scooper    print(upper(user_input))15:45
scooperprint_capitalized("Spencer");15:45
shmohamudit shouldn't be upper, try capitalize()15:45
scooperupper is the build in function for python15:45
fkoikoiis this what you are talking about: def Hello_From Monrovia():15:45
fkoikoiprint ("Hello from Monrovia")15:45
shmohamudalso the way you call it is like this: https://www.w3schools.com/python/ref_string_upper.asp15:45
shmohamudexactly fkoikoi, great job15:46
shmohamudit's a method on the string class, so all strings have the upper method but you have to use dot notation to access it15:46
fkoikoibut it show syntax error when i run it15:46
scooperdot notation is not working15:47
scooperthis is the error message NameError: name 'upper' is not defined15:47
shmohamuddef print_capitalized(str):15:48
shmohamud  print(str.capitalize())15:48
shmohamudprint_capitalized("sam")15:48
shmohamudtry that spencer15:48
shmohamudfkoikoi, you can't have spaces in the name of a function15:48
shmohamudmust be Hello_From_Monrovia:15:48
shmohamuddef Hello_From_Monrovia15:48
fkoikoiyou mean this15:49
fkoikoidef Hello_From_Monrovia():15:49
fkoikoiprint ("Hello from Monrovia")15:49
shmohamudyep that executes without errors right?15:50
fkoikoiyes15:50
scooperdef pirnt_capitalized(str):15:50
scooper    15:50
scooper    print(str.capitalize())15:50
scooperprint_capitalized("sam")15:50
scooperNameError: name 'print_capitalized' is not defined15:51
scooperlet me try "upper"15:51
shmohamudbecause look at how the function is spelled15:51
shmohamudit's spelled "pirnt_capitalized" should be "print_capitalized"15:51
scooperdef print_capitalized(str):15:53
scooper    15:53
scooper    print(upper(print_capitalized))15:53
scooperprint_capitalized("sam")15:53
scooperit is still the same15:53
shmohamudbecause upper is should be switched to capitalize()15:54
scooperNOw it run15:54
scooperdef print_capitalized(str):15:54
scooper    15:54
scooper    print(str.upper())15:54
scooperprint_capitalized("sam")15:54
shmohamudAnd you can't call a function it itself15:54
shmohamudOk, great catch!15:55
shmohamudNow, just switch upper to capitalize() and we're good15:55
scooperit work15:56
scooperdef print_capitalized(str):15:56
scooper    15:56
scooper    print(str.capitalize())15:56
scooperprint_capitalized("sam")15:56
shmohamudbeautiful, well done15:56
shmohamudthat's working now right?15:56
scooperYes15:56
scooperQuestion15:56
shmohamudyrs15:56
scooperwhy this didn't work first "print(lower(user_input))"15:57
shmohamudbecsuse lower is a method on strings15:58
scooperWhy this didn't work first print(upper(user_input))15:58
shmohamudand accessing methods on a string requires dot notation15:58
shmohamudthat makes sense?15:59
scoopersure it's15:59
shmohamudhttps://www.w3schools.com/python/python_ref_string.asp16:00
shmohamudread those when you have time16:00
shmohamudthey're all methods on strinh16:00
shmohamudok guys, anything else before I get going here?16:01
scooperYes16:02
shmohamudok16:02
shmohamudlets hear it16:02
scooperThat mean dot notation can work on a parameter right 16:02
shmohamudgreat question. Yes, if we recieve a paramater that is a *string* type we can use *string* methods on it16:03
shmohamudSame for integer parameters, except you could use *integer* methods on it.16:04
shmohamudDoes that answer the question?16:04
scooperSure One before you leave??16:04
shmohamudSure!16:04
fkoikoiSo functions works with an argument right?16:05
scooperreturn only work in a function right???16:05
shmohamudfkoikoi you can call it an argument or parameter, they're interchangeable it just means def function("parameter or argument")16:05
fkoikoialright16:06
shmohamudscooper16:06
scooperyes16:06
shmohamudwhy don't you test it in the IDE16:07
scooperOk I will and give you the result tomorrow16:07
shmohamudtry just returning like return "X" without it being in a function16:07
shmohamudthen, try it inside a function and see16:07
scoopernow or later??16:07
shmohamudwe know it works inside a function, but what about outside?16:07
shmohamudTry now16:07
shmohamud  File "main.py", line 116:08
shmohamud    return "X"16:08
shmohamud    ^^^^^^^^^^16:08
shmohamudSyntaxError: 'return' outside function16:08
shmohamud]16:08
scooperThe result say16:08
shmohamudThat's the beauty of testing things, you'll get the error message yourself16:08
scooperreturn out of function16:08
shmohamudYup16:08
shmohamudso it can't be used outside of a function, great question!16:09
scooperThanks shmohamud any task for today16:09
shmohamudany more questions?16:09
scooperthat can be presented to keep us busy??16:10
shmohamudsure16:10
shmohamudWrite a function that takes in two parameters, numA and numB, and return the result of them added together16:10
scooperok thanks16:11
shmohamudyou're welcome. Any questions fkoikoi?16:11
fkoikoiYes16:12
shmohamudlet's hear it16:12
fkoikoican you used the if and else statement when looping? 16:13
shmohamudGreat question. Yes, you can. Yesterday, we printed evens only if they passed an if statment16:13
fkoikoialright 16:13
shmohamudI recommend trying it yourself, too, and share the result with us :) 16:14
fkoikoiso is there any other thing that I can do?16:14
shmohamudwrite me a loop that has an if statement in it16:14
shmohamudany further questions?16:14
fkoikoino16:15
shmohamudalrighty, have a great rest of you day guys. Great job today.16:15
fkoikoiThanks for the time16:15
fkoikoihave a nice day shmohamud16:16
scooperI you still there16:20
scooperare you still there shmohamud??16:21
*** scooper has quit (Quit: Leaving)16:21
*** fkoikoi has quit (Ping timeout: 480 seconds)16:30
*** shmohamud has quit (Remote host closed the connection)16:38
*** shmohamud has quit (Remote host closed the connection)16:43
*** shmohamud has quit (Remote host closed the connection)17:05
*** shmohamud has quit (Remote host closed the connection)17:40
*** shmohamud has quit (Remote host closed the connection)20:22
*** shmohamud has quit (Ping timeout: 480 seconds)20:39
*** shmohamud has quit (Remote host closed the connection)21:36
*** shmohamud has quit (Read error: Connection reset by peer)21:40
*** shmohamu_ has quit (Remote host closed the connection)21:56
*** shmohamud has quit (Remote host closed the connection)22:17
*** shmohamud has quit (Remote host closed the connection)23:21
*** shmohamud has quit (Ping timeout: 480 seconds)23:30

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