*** 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 | |
shmohamud | Good day Spencer | 13:05 |
---|---|---|
*** shmohamud has quit (Remote host closed the connection) | 13:09 | |
*** sysadmin__ has quit (Quit: Leaving) | 13:14 | |
jelkner | hello scooper and fkoikoi | 13:24 |
scooper | Good morning Jeff | 13:25 |
jelkner | tmickelson has to retate a Spanish quiz, so he won't be here today | 13:25 |
fkoikoi | Good morning Jeff | 13:25 |
scooper | OK Jeff | 13:25 |
jelkner | Good day, fkoikoi | 13:25 |
jelkner | i read over the log from yesterday | 13:25 |
scooper | We will await shmohamud | 13:26 |
jelkner | shmohamud is an awesome tutor! | 13:26 |
scooper | he promised to assist use with python | 13:26 |
jelkner | i can help with that too | 13:26 |
scooper | before moving to javascript that what I guess | 13:27 |
scooper | If you can what are your available time to help us? | 13:27 |
jelkner | yes, don't confuse things | 13:27 |
jelkner | your first programming language is hard to learn | 13:27 |
jelkner | the 2nd one is *much* easier | 13:28 |
jelkner | and after awhile, you can learn a new one in a short time | 13:28 |
jelkner | since they all operate on the same computer, they all do fundamentally the same thing | 13:28 |
jelkner | but in the beginning, trying to learn two at once is very confusing | 13:28 |
jelkner | and Python is your best choice for a 1st language | 13:29 |
jelkner | do you have any questions i can answer now? | 13:29 |
scooper | That is why I m really struggling with Java.... | 13:30 |
jelkner | yes, i understand | 13:30 |
jelkner | you have no choice, since you're taking a class | 13:30 |
jelkner | i can help with that too | 13:30 |
jelkner | what chapter are you reading now? | 13:30 |
jelkner | since i have the book, i could look through it | 13:30 |
scooper | Chapter 5 | 13:30 |
jelkner | scooper, do you have a namecheap account yet? | 13:30 |
scooper | I will do it today Jeff | 13:31 |
jelkner | we need to transfer the mcssliberia.org domain to you | 13:31 |
scooper | I really busy with tmickelson and shomamud these few days | 13:31 |
scooper | that why | 13:31 |
scooper | I advise you ask me a python question to know how far my understand is in python | 13:32 |
scooper | *understanding | 13:33 |
jelkner | scooper, that's not really the best approach | 13:36 |
jelkner | there are *so many* python questions | 13:36 |
scooper | OK | 13:36 |
scooper | this is what I have cover so far in the python book | 13:37 |
jelkner | and learning programming languages, since they are formal languages that express computations, is more like learning math then it is like learning French | 13:37 |
jelkner | you need to learn some things before you learn others | 13:37 |
scooper | variable, datatype, condition, loop | 13:37 |
jelkner | what is a datatype? | 13:37 |
scooper | ok | 13:38 |
scooper | Datatype is particular kind of data that belong to a certain group in python or programming | 13:38 |
jelkner | yes, except that is a bit circular | 13:39 |
jelkner | it's like saying "a datatype is a type of data" | 13:39 |
jelkner | yes, but what does that mean? ;-) | 13:39 |
jelkner | it is hard to define datatype | 13:39 |
jelkner | because the idea is pretty foundational | 13:40 |
scooper | It mean it defined by the kind of information it except | 13:40 |
scooper | accept | 13:40 |
jelkner | but a data type is a set of values, and the operations that can be performed on those values | 13:40 |
jelkner | give me some examples of datatypes in python. | 13:41 |
scooper | some example of data in python are | 13:41 |
scooper | whole number | 13:41 |
scooper | loat number | 13:41 |
scooper | string | 13:41 |
scooper | float number | 13:41 |
jelkner | so positive and negative whole numbers in python are called int | 13:42 |
scooper | even List, dictionary tuple etc | 13:42 |
scooper | are example of data type in python | 13:42 |
jelkner | numbers with both a whole number part and a fractional part are called float | 13:42 |
jelkner | you're missing one really important type | 13:42 |
jelkner | scooper, do you have a python shell running? | 13:43 |
scooper | I can run it if you want me to | 13:43 |
jelkner | i do want you to | 13:43 |
scooper | yes I just did | 13:44 |
jelkner | you should never try learning python without having python around! | 13:44 |
jelkner | so you can "ask python" what type a given value has | 13:44 |
jelkner | for example: | 13:44 |
jelkner | type("Hello, Spencer!") | 13:44 |
jelkner | try it | 13:44 |
jelkner | what do you get? | 13:44 |
scooper | it is a string data type | 13:44 |
jelkner | yes, and the python REPL will respond with: | 13:45 |
jelkner | <class 'str'> | 13:45 |
jelkner | yes? | 13:45 |
jelkner | yes, scooper? | 13:46 |
jelkner | please confirm | 13:46 |
scooper | yes | 13:46 |
jelkner | great, now try: | 13:46 |
jelkner | type(42) | 13:46 |
scooper | <class 'str'> | 13:46 |
scooper | this is an int | 13:47 |
scooper | let try first | 13:47 |
jelkner | yup | 13:47 |
scooper | <class 'int'> | 13:47 |
jelkner | +1 | 13:47 |
jelkner | starting with str and int is good | 13:47 |
scooper | Jeff | 13:48 |
jelkner | because we can use that to dig in a bit deeper into datatypes | 13:48 |
jelkner | type("42") | 13:48 |
scooper | what when you use double quotes on integer it say it's string?? | 13:48 |
jelkner | exactly | 13:48 |
jelkner | "42" is *not* a number, it's a string! | 13:49 |
jelkner | a string is a sequence of characters | 13:49 |
scooper | >>> type("42") | 13:49 |
scooper | <class 'str'> | 13:49 |
scooper | >>> | 13:49 |
jelkner | things that can be typed on a keyboard | 13:49 |
jelkner | "4" is a character | 13:49 |
jelkner | it is not a number | 13:49 |
jelkner | though python knows how to convert it into a number | 13:50 |
jelkner | try: | 13:50 |
jelkner | int("42") | 13:50 |
scooper | >>> int("42") | 13:50 |
scooper | 42 | 13:50 |
scooper | >>> | 13:50 |
jelkner | yup, no quotes anymore | 13:50 |
jelkner | and if you do: | 13:50 |
jelkner | n = int("42") | 13:50 |
jelkner | type(n) | 13:50 |
jelkner | you'll get: | 13:51 |
jelkner | <class int> | 13:51 |
jelkner | <class 'int'> | 13:51 |
jelkner | going the other way | 13:51 |
scooper | >>> n = int("42") | 13:51 |
scooper | >>> type(n) | 13:51 |
scooper | <class 'int'> | 13:51 |
scooper | >>> | 13:51 |
jelkner | type(str(42)) | 13:51 |
jelkner | <class 'str'> | 13:51 |
jelkner | but if we try: | 13:52 |
scooper | >>> type(str(42)) | 13:52 |
scooper | <class 'str'> | 13:52 |
scooper | >>> | 13:52 |
jelkner | int("cheese") | 13:52 |
jelkner | we get a traceback | 13:52 |
jelkner | ending with | 13:52 |
jelkner | ValueError: invalid literal for int() with base 10: 'cheese' | 13:52 |
scooper | >>> int("cheese") | 13:53 |
scooper | Traceback (most recent call last): | 13:53 |
scooper | File "<stdin>", line 1, in <module> | 13:53 |
scooper | ValueError: invalid literal for int() with base 10: 'cheese' | 13:53 |
scooper | >>> | 13:53 |
jelkner | python doesn't know how to convert 'cheese' into a number ;-) | 13:53 |
jelkner | i don't either | 13:53 |
jelkner | now, what is a variable? | 13:54 |
scooper | In Python a variable is a memory location that store information | 13:54 |
jelkner | sort of | 13:54 |
jelkner | it is better in python to think at a higher level of abstraction | 13:55 |
jelkner | a variable is "a name that refers to a value" | 13:55 |
jelkner | scooper, i only have 5 minutes left | 13:55 |
jelkner | hopefully Sahnun will show up to continue | 13:55 |
scooper | Thanks Jeff | 13:56 |
jelkner | what book are you using to learn python? | 13:56 |
scooper | Python for everybody | 13:56 |
jelkner | Wonderful! | 13:56 |
jelkner | so where are you in the book? | 13:57 |
jelkner | if we use the book as our guide, i can help with questions and things | 13:57 |
jelkner | since i will be able to choose questions appropriate for where you are in the text | 13:57 |
jelkner | we need to make this "tutoring" | 13:58 |
jelkner | which means: | 13:58 |
scooper | String | 13:58 |
jelkner | 1. *You* are responsible for driving the process and setting the pace | 13:58 |
jelkner | shmohamud and jelkner are responsible for *helping* you | 13:58 |
scooper | welcome shmohamud | 13:59 |
jelkner | by answering questions and providing more examples to help make Dr. Chuck's presentation understandable | 13:59 |
jelkner | shmohamud, i looked at the logs from yesterday | 13:59 |
jelkner | you are an *awesome* tutor! | 13:59 |
jelkner | ok, bell rang, i need to go | 14:00 |
jelkner | shmohamud, let's tag team on this | 14:00 |
jelkner | and use Python for Everybody as our guide | 14:00 |
jelkner | so we can switch back and forth and remain relatively consistent | 14:00 |
jelkner | make sense? | 14:00 |
jelkner | scooper, see you tomorrow at the same time | 14:01 |
jelkner | ACTION logs off | 14:01 |
*** jelkner has quit (Quit: Leaving) | 14:01 | |
*** shmohamud has quit (Ping timeout: 480 seconds) | 14:06 | |
scooper | Good morning shmohamud are you still there??? | 14:06 |
fkoikoi | Good morning shmohamud | 14:23 |
shmohamud | Good morning Fkoikoi | 15:08 |
fkoikoi | How are you shmohamud? | 15:09 |
shmohamud | Good, how are you? | 15:09 |
fkoikoi | I'm fine | 15:09 |
shmohamud | Let's have a quick session today | 15:09 |
shmohamud | Sound good? | 15:10 |
fkoikoi | alright | 15:10 |
shmohamud | ok, so, loops | 15:10 |
shmohamud | Can you write me a for loop that prints out every number betweeen 1 and 100? | 15:10 |
scooper | good morning shmohamud | 15:11 |
shmohamud | good morning Spencer | 15:11 |
shmohamud | spencer, do you know how to write a function in python? | 15:12 |
scooper | yes | 15:12 |
shmohamud | can you write me a function that takes in a name parameter, and returns me the name capitalized? | 15:12 |
shmohamud | prints the name capitalized* | 15:12 |
shmohamud | call it print_capitalized | 15:13 |
scooper | let me give it a try | 15:13 |
shmohamud | ok. Fkoikoi, are you working on the loop? | 15:13 |
scooper | should the function be called print_capitalized? | 15:13 |
shmohamud | Yes | 15:13 |
scooper | ok | 15:13 |
shmohamud | fkoikoi? | 15:15 |
fkoikoi | yes | 15:15 |
fkoikoi | I'm working on it | 15:16 |
shmohamud | ok good | 15:16 |
fkoikoi | value = 100 | 15:19 |
fkoikoi | for num in range (2, value): | 15:19 |
fkoikoi | print (num) | 15:19 |
shmohamud | Good. Now what if I asked you to change the code so that it includes 1 and 100 too | 15:20 |
shmohamud | could you show me what it would look like? | 15:21 |
fkoikoi | yes | 15:22 |
fkoikoi | value = 100 | 15:24 |
fkoikoi | for num in range (1, value): | 15:24 |
fkoikoi | print (num) | 15:24 |
scooper | shmohamud | 15:24 |
scooper | should the program allow user input | 15:24 |
shmohamud | almost fkoikoi. Does 100 print out or does it stop at 99? | 15:24 |
shmohamud | Scooper, it shouldn't. | 15:25 |
scooper | ok | 15:25 |
fkoikoi | it stop to 99 | 15:25 |
shmohamud | I will make that clear if that's the case. I just want it to print any string it recieves capitalized. | 15:25 |
shmohamud | fkoikoi - change it so that 100 gets printed too. There is more than 1 way to do it. | 15:26 |
scooper | def print_capitalized(user_input): | 15:30 |
scooper | user = "Spencer" | 15:30 |
scooper | return (upper(user)) | 15:30 |
scooper | print_capitalized(user_input) | 15:30 |
shmohamud | Scooper, almost! First line is perfect | 15:30 |
shmohamud | Why have you defined a variable, user, inside the function? | 15:31 |
scooper | to store the value "SPener | 15:31 |
shmohamud | And also - remember I asked you to print it, not to return | 15:31 |
shmohamud | No need to store it, we have the variable from the user_input. Does that make sense | 15:31 |
fkoikoi | value = 101 | 15:32 |
fkoikoi | for num in range (1, value): | 15:32 |
fkoikoi | print (num) | 15:32 |
fkoikoi | 15:32 | |
scooper | user_input is serving as a parameter | 15:32 |
shmohamud | Great job Fkoikoi, that's what I was looking for! | 15:32 |
fkoikoi | thanks shmohamud | 15:32 |
shmohamud | yes it is, but when you call the function, that's when you add "spencer" to it | 15:32 |
scooper | and when the function is call it take an argument of the value in the parenthesis | 15:32 |
shmohamud | Yes, it does. That's why when you call it, it should be "print_capitalized("spencer") | 15:33 |
shmohamud | And 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 |
shmohamud | Can 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 |
scooper | ok let me give it a try | 15:35 |
shmohamud | fkoikoi, do you know how to write functions in python? | 15:35 |
fkoikoi | hmm, except I read on it | 15:37 |
shmohamud | ok, can you read this: https://www.w3schools.com/python/python_functions.asp | 15:37 |
shmohamud | After that, write me a function that prints out "Hello from Monrovia" | 15:38 |
scooper | shmohamud | 15:39 |
scooper | there is an error will my function | 15:39 |
shmohamud | what's the error? | 15:39 |
scooper | Name Error | 15:39 |
shmohamud | show me the code please | 15:39 |
scooper | the value are placed in the argument is causing problem | 15:40 |
shmohamud | you shouldn't call it with anything but a string "spencer" or "sahnun" | 15:40 |
shmohamud | is that the issue? | 15:40 |
fkoikoi | print ("Hello from Monrovia") | 15:41 |
scooper | def print_capitalized(user_input): | 15:41 |
scooper | 15:41 | |
scooper | print(user_input) | 15:41 |
scooper | print_capitalized("Spencer"); | 15:41 |
shmohamud | yes fkoikoi. Now, put that in a function called "hello_from_monrovia" | 15:41 |
scooper | OK I found the error | 15:41 |
shmohamud | That function is perfect except one thing, where is the capitalization happening? | 15:42 |
scooper | When I was calling the function I didn't indicate the string in quotation | 15:42 |
shmohamud | Nice work | 15:42 |
shmohamud | perfect, good catch. | 15:42 |
fkoikoi | print ("Hello_from Monrovia") | 15:42 |
shmohamud | fkoikoi I mean you should define the function like this: | 15:42 |
shmohamud | def hello_from_monrovia: | 15:43 |
fkoikoi | okay | 15:43 |
shmohamud | print("Hello From Monrovia") | 15:43 |
shmohamud | then you can call the function | 15:43 |
shmohamud | hello_from_monrovia() and it will print out | 15:43 |
scooper | my program say upper is not defined | 15:45 |
scooper | def print_capitalized(user_input): | 15:45 |
scooper | 15:45 | |
scooper | print(upper(user_input)) | 15:45 |
scooper | print_capitalized("Spencer"); | 15:45 |
shmohamud | it shouldn't be upper, try capitalize() | 15:45 |
scooper | upper is the build in function for python | 15:45 |
fkoikoi | is this what you are talking about: def Hello_From Monrovia(): | 15:45 |
fkoikoi | print ("Hello from Monrovia") | 15:45 |
shmohamud | also the way you call it is like this: https://www.w3schools.com/python/ref_string_upper.asp | 15:45 |
shmohamud | exactly fkoikoi, great job | 15:46 |
shmohamud | it's a method on the string class, so all strings have the upper method but you have to use dot notation to access it | 15:46 |
fkoikoi | but it show syntax error when i run it | 15:46 |
scooper | dot notation is not working | 15:47 |
scooper | this is the error message NameError: name 'upper' is not defined | 15:47 |
shmohamud | def print_capitalized(str): | 15:48 |
shmohamud | print(str.capitalize()) | 15:48 |
shmohamud | print_capitalized("sam") | 15:48 |
shmohamud | try that spencer | 15:48 |
shmohamud | fkoikoi, you can't have spaces in the name of a function | 15:48 |
shmohamud | must be Hello_From_Monrovia: | 15:48 |
shmohamud | def Hello_From_Monrovia | 15:48 |
fkoikoi | you mean this | 15:49 |
fkoikoi | def Hello_From_Monrovia(): | 15:49 |
fkoikoi | print ("Hello from Monrovia") | 15:49 |
shmohamud | yep that executes without errors right? | 15:50 |
fkoikoi | yes | 15:50 |
scooper | def pirnt_capitalized(str): | 15:50 |
scooper | 15:50 | |
scooper | print(str.capitalize()) | 15:50 |
scooper | print_capitalized("sam") | 15:50 |
scooper | NameError: name 'print_capitalized' is not defined | 15:51 |
scooper | let me try "upper" | 15:51 |
shmohamud | because look at how the function is spelled | 15:51 |
shmohamud | it's spelled "pirnt_capitalized" should be "print_capitalized" | 15:51 |
scooper | def print_capitalized(str): | 15:53 |
scooper | 15:53 | |
scooper | print(upper(print_capitalized)) | 15:53 |
scooper | print_capitalized("sam") | 15:53 |
scooper | it is still the same | 15:53 |
shmohamud | because upper is should be switched to capitalize() | 15:54 |
scooper | NOw it run | 15:54 |
scooper | def print_capitalized(str): | 15:54 |
scooper | 15:54 | |
scooper | print(str.upper()) | 15:54 |
scooper | print_capitalized("sam") | 15:54 |
shmohamud | And you can't call a function it itself | 15:54 |
shmohamud | Ok, great catch! | 15:55 |
shmohamud | Now, just switch upper to capitalize() and we're good | 15:55 |
scooper | it work | 15:56 |
scooper | def print_capitalized(str): | 15:56 |
scooper | 15:56 | |
scooper | print(str.capitalize()) | 15:56 |
scooper | print_capitalized("sam") | 15:56 |
shmohamud | beautiful, well done | 15:56 |
shmohamud | that's working now right? | 15:56 |
scooper | Yes | 15:56 |
scooper | Question | 15:56 |
shmohamud | yrs | 15:56 |
scooper | why this didn't work first "print(lower(user_input))" | 15:57 |
shmohamud | becsuse lower is a method on strings | 15:58 |
scooper | Why this didn't work first print(upper(user_input)) | 15:58 |
shmohamud | and accessing methods on a string requires dot notation | 15:58 |
shmohamud | that makes sense? | 15:59 |
scooper | sure it's | 15:59 |
shmohamud | https://www.w3schools.com/python/python_ref_string.asp | 16:00 |
shmohamud | read those when you have time | 16:00 |
shmohamud | they're all methods on strinh | 16:00 |
shmohamud | ok guys, anything else before I get going here? | 16:01 |
scooper | Yes | 16:02 |
shmohamud | ok | 16:02 |
shmohamud | lets hear it | 16:02 |
scooper | That mean dot notation can work on a parameter right | 16:02 |
shmohamud | great question. Yes, if we recieve a paramater that is a *string* type we can use *string* methods on it | 16:03 |
shmohamud | Same for integer parameters, except you could use *integer* methods on it. | 16:04 |
shmohamud | Does that answer the question? | 16:04 |
scooper | Sure One before you leave?? | 16:04 |
shmohamud | Sure! | 16:04 |
fkoikoi | So functions works with an argument right? | 16:05 |
scooper | return only work in a function right??? | 16:05 |
shmohamud | fkoikoi you can call it an argument or parameter, they're interchangeable it just means def function("parameter or argument") | 16:05 |
fkoikoi | alright | 16:06 |
shmohamud | scooper | 16:06 |
scooper | yes | 16:06 |
shmohamud | why don't you test it in the IDE | 16:07 |
scooper | Ok I will and give you the result tomorrow | 16:07 |
shmohamud | try just returning like return "X" without it being in a function | 16:07 |
shmohamud | then, try it inside a function and see | 16:07 |
scooper | now or later?? | 16:07 |
shmohamud | we know it works inside a function, but what about outside? | 16:07 |
shmohamud | Try now | 16:07 |
shmohamud | File "main.py", line 1 | 16:08 |
shmohamud | return "X" | 16:08 |
shmohamud | ^^^^^^^^^^ | 16:08 |
shmohamud | SyntaxError: 'return' outside function | 16:08 |
shmohamud | ] | 16:08 |
scooper | The result say | 16:08 |
shmohamud | That's the beauty of testing things, you'll get the error message yourself | 16:08 |
scooper | return out of function | 16:08 |
shmohamud | Yup | 16:08 |
shmohamud | so it can't be used outside of a function, great question! | 16:09 |
scooper | Thanks shmohamud any task for today | 16:09 |
shmohamud | any more questions? | 16:09 |
scooper | that can be presented to keep us busy?? | 16:10 |
shmohamud | sure | 16:10 |
shmohamud | Write a function that takes in two parameters, numA and numB, and return the result of them added together | 16:10 |
scooper | ok thanks | 16:11 |
shmohamud | you're welcome. Any questions fkoikoi? | 16:11 |
fkoikoi | Yes | 16:12 |
shmohamud | let's hear it | 16:12 |
fkoikoi | can you used the if and else statement when looping? | 16:13 |
shmohamud | Great question. Yes, you can. Yesterday, we printed evens only if they passed an if statment | 16:13 |
fkoikoi | alright | 16:13 |
shmohamud | I recommend trying it yourself, too, and share the result with us :) | 16:14 |
fkoikoi | so is there any other thing that I can do? | 16:14 |
shmohamud | write me a loop that has an if statement in it | 16:14 |
shmohamud | any further questions? | 16:14 |
fkoikoi | no | 16:15 |
shmohamud | alrighty, have a great rest of you day guys. Great job today. | 16:15 |
fkoikoi | Thanks for the time | 16:15 |
fkoikoi | have a nice day shmohamud | 16:16 |
scooper | I you still there | 16:20 |
scooper | are 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/!