*** fkoikoi has quit (Ping timeout: 480 seconds) | 12:52 | |
*** tboimah has quit (Ping timeout: 480 seconds) | 12:52 | |
*** Janet has quit (Quit: Leaving) | 13:14 | |
ubuntourist | Hi Janet tboimah_ | 14:01 |
---|---|---|
ubuntourist | I do not have any great wisdom to dispense today... | 14:01 |
tboimah_ | Good morning ubuntourist | 14:01 |
ubuntourist | I have become less helpful because I believe the web pages that Jeff has sent will teach you almost everything you need. | 14:03 |
tboimah | sure | 14:03 |
ubuntourist | But I am here for questions and the occasional tip. | 14:03 |
ubuntourist | I was talking a lot with svaye about truth tables last time. | 14:04 |
tboimah | okay let me send you some question | 14:04 |
tboimah | just give me a minute | 14:04 |
ubuntourist | For me, understanding Boolean logic and Boolean algebra, and binary were invaluable. | 14:05 |
ubuntourist | tboimah, okay... | 14:05 |
Janet | Hi Mr. Cole | 14:06 |
ubuntourist | hi Janet | 14:06 |
tboimah | why is this print('100' == '0100', end=' ') | 14:07 |
tboimah | print('100' > '0100', end=' ') | 14:07 |
tboimah | print('100' > '80', end=' ') | 14:07 |
tboimah | print('200' < '80', end=' ') | 14:07 |
tboimah | print('200' < '800') code giving False True False True True | 14:07 |
tboimah | as the answer | 14:07 |
ubuntourist | hi dcammue I don't think I have an e-mail address for you. | 14:08 |
tboimah | that question is for you ubuntourist | 14:08 |
dcammue | yes | 14:08 |
svaye | Good morning Mr Cole | 14:08 |
dcammue | here is it | 14:08 |
ubuntourist | tboimah, got it. | 14:09 |
dcammue | dainelcammue@gmail.com, my novaweb mail is giving hard time so just use this one for now | 14:09 |
ubuntourist | tboimah, think about the quote marks... | 14:09 |
ubuntourist | dcammue, thanks. | 14:10 |
tboimah | yeah i understand that is a string | 14:10 |
tboimah | not an intreger | 14:10 |
ubuntourist | tboimah, Good. So, now, think about strings. Which is "less" than the other: | 14:10 |
ubuntourist | "Bob" or "Joe"? | 14:11 |
tboimah | Bob | 14:11 |
ubuntourist | Right again. Now: | 14:12 |
ubuntourist | "Bob" == "OBob"? True or false? | 14:12 |
tboimah | False | 14:13 |
ubuntourist | "100" == "0100"? True or false? | 14:13 |
gabriel | false | 14:14 |
ubuntourist | "10" > "01"? | 14:14 |
tboimah | True | 14:15 |
ubuntourist | And so "100" > "010" and "100" > "0100000000" because in ALPHABETICAL order, 1 will ALWAYS come after 0, and 1 is the first "letter" in one of the two strings. | 14:18 |
tboimah | Okay i understand now it deal with the first number. | 14:19 |
tboimah | it is not looking at the length | 14:19 |
ubuntourist | If you change 0, 1, 2, 3, ... to A, B, C, D it makes it clearer.. | 14:20 |
ubuntourist | tboimah, Right. Exactly. | 14:20 |
tboimah | I get the understanding now | 14:20 |
tboimah | Thank you | 14:20 |
ubuntourist | It is lookiing at how you would find them in an index of a book if they were strings. | 14:21 |
ubuntourist | How is everyone else doing? Questions? | 14:21 |
tboimah | I have one more question | 14:21 |
ubuntourist | tboimah, go ahead | 14:22 |
tboimah | why is the print('123abc'.isalnum(), end=' ') | 14:23 |
tboimah | print('abc'.isalnum(), end=' ') | 14:23 |
tboimah | print('12'.isalnum(), end=' ') | 14:23 |
tboimah | print('@'.isalnum(), end=' ') | 14:23 |
tboimah | print('123_abc'.isalnum(), end=' ') | 14:23 |
tboimah | print(''.isalnum()) giving the answer to be True True True False False False | 14:23 |
ubuntourist | isalnum means is_al_num mean is alpha-numeric. | 14:25 |
ubuntourist | It only includes alphabetic characters or numeic characters. A-Z, a-z, and 0-9. | 14:26 |
ubuntourist | Anything else is punctuation or something else. Not alphanumeric. | 14:26 |
ubuntourist | (Actually, I am speaking with my American bias. We live in a bigger world now, | 14:27 |
ubuntourist | but I am usually only dealing with English. Now there are lots of other characters that would be | 14:27 |
ubuntourist | considered "alphabetic". But I've never tried feeding Arabic, Hebrew, Chinese or Japanese | 14:28 |
ubuntourist | characters into Python and asking if they are alphanumeirc.) | 14:28 |
tboimah | okay i understand now when ever it dose not content an alphabet or a number is a False | 14:30 |
tboimah | but if dose then it is a True | 14:30 |
ubuntourist | If any character in the string is not a number or letter, then it's false. Otherwise, it's true. | 14:31 |
tboimah | sure | 14:31 |
ubuntourist | (For an English speaker it becomes strange: I studied a little bit of Chinese, and I like the grammar: | 14:32 |
ubuntourist | To ask a question, you can either make a statement and add a question mark to the end, or you can ask a "multiple choice" question. | 14:33 |
ubuntourist | For example, I would not say "How are you?" I would say "You are fine question mark" or I would say "You are fine or not fine" | 14:34 |
ubuntourist | and expect you to answer "I am fine". | 14:34 |
ubuntourist | "Ni hao" = "You are fine". | 14:35 |
ubuntourist | "Ni hao ma" = "You are fine question". | 14:35 |
ubuntourist | "Ni hao bu hao" = "You are fine not fine" | 14:35 |
ubuntourist | So, because "ma" means "?" is the Chinese way of printing "ma" a punctuation mark or a letter? I don't know. | 14:36 |
tboimah | okay | 14:38 |
gabriel | ok | 14:38 |
ubuntourist | Anyway, if you end up doing Python work for a Chinese person or organization, isalnum() could give interesting results. ;-) | 14:39 |
tboimah | waiting to experence that in the fature | 14:40 |
tboimah | *future | 14:40 |
ubuntourist | By the way, if you have not read the IRC log of my discussion with svaye on Boolean and truth tables, | 14:41 |
ubuntourist | I recommend that you do. | 14:41 |
tboimah | I did that already | 14:41 |
tboimah | Boolean have to do with "True" and "False" | 14:41 |
ubuntourist | And later, we can do the same thing with bits. Instead of having five variables that are set to True or False, | 14:42 |
ubuntourist | we can have ONE variable, and use five bits of the variable to set them to 1 or 0 instead. | 14:42 |
ubuntourist | ( tboimah and mulbah had a preview of this when we were talking about "chmod" "rwx" and octal. So talk with them about it.) | 14:44 |
ubuntourist | (rwxr-xr-x = 111101101 = 755) | 14:45 |
ubuntourist | ( = True, True, True, True, False, True, True, False, True) | 14:45 |
tboimah | sure | 14:45 |
tboimah | for everywhere you see "1" you represent it by True and where you "0" you represent it by False | 14:46 |
tboimah | *see | 14:46 |
ubuntourist | In many of your Python programs you will have several conditions, and often it is clearer to have separate variables for different conditions. | 14:47 |
ubuntourist | But sometimes, it will make sense to combine all the conditions into a single variable using bits instead. | 14:47 |
ubuntourist | Using permissions as an example, you could have lots of variables: | 14:48 |
ubuntourist | owner_read = True | 14:48 |
ubuntourist | owner_write = True | 14:49 |
ubuntourist | owner_execute = True | 14:49 |
ubuntourist | group_read = True | 14:49 |
ubuntourist | group_write = False | 14:49 |
ubuntourist | ... and so on. OR, you could have one variable: | 14:50 |
ubuntourist | permissions = 0o755 # 0o means "octal". So 755 octal. | 14:50 |
tboimah | 0x755 means "hexadecimal" 755 | 14:51 |
tboimah | is that right | 14:52 |
ubuntourist | tboimah, yes but I was trying to stick with the "rwxr-xr-x" example. So I didn't want to talk about hexidecimal. | 14:52 |
tboimah | okay | 14:53 |
tboimah | sorry that | 14:53 |
tboimah | *for | 14:53 |
ubuntourist | tboimah (You can't use hex with "chmod" you can only use the letters or the octal value) | 14:53 |
ubuntourist | tboimah, but it is good to know about 0o, 0x and 0b for binary | 14:54 |
ubuntourist | tboimah, they will all come in very handy at some point in your careers. (I use hex more than octal or binary.) | 14:54 |
ubuntourist | When writing code ask yourself: | 14:55 |
tboimah | Okay thanks for the motivation | 14:55 |
ubuntourist | 1. Is it clear? Did I choose good variable names, and good comments? If I am on vacation, or sick or move to a different country, will someone else be able to improve my code? | 14:56 |
ubuntourist | 2. Is it "modular"? Do not try to write code that is a 900-page masterpiece novel or a 5-hour movie. Write small stories and chapters that can be broken apart | 14:57 |
ubuntourist | and put together in different ways to tell larger stories. When you do something "clever" | 14:58 |
ubuntourist | think about "What if I want to do that clever thing in another program?" | 14:58 |
ubuntourist | If you start creating functions, and later, classses and objects, you will be able to reuse your code in | 14:59 |
ubuntourist | different ways. | 14:59 |
ubuntourist | When you use "import" that's what you're doing: Someone has taken the time to break big ideas into small | 14:59 |
ubuntourist | reusable parts that let you make your programs simpler and easier to understand. | 15:00 |
ubuntourist | These are good things to think about now, while your programs are small and managable. Establish good habits early, | 15:01 |
ubuntourist | so that you won't need to break your bad habits later. | 15:01 |
tboimah | okay | 15:02 |
ubuntourist | I have a joke with jelkner - I keep telling him I am going to write a book called "Worst Practices" | 15:03 |
ubuntourist | that will teach students all of my bad habits that I have not succeeded in breaking. | 15:03 |
ubuntourist | One of the "best practices" is called DRY -- Don't Repeat Yourself. | 15:04 |
ubuntourist | But my book will have RYE -- Repeat Yourself Everywhere. | 15:05 |
ubuntourist | DRY means you should avoid just copying and pasting the same code again and again. | 15:05 |
ubuntourist | Instead, you should turn it into a function. For example, you really don't need multiplication: You can | 15:06 |
ubuntourist | multiply by repeating addition again and again. But that is a very stupid thing to do. | 15:06 |
ubuntourist | Instead of "x = 5 * 20" I could write: | 15:07 |
ubuntourist | x = 0 | 15:07 |
ubuntourist | for y in range(5): | 15:07 |
ubuntourist | x = x + 20 | 15:07 |
ubuntourist | Dumb. | 15:08 |
ubuntourist | Any time you are thinking "... there should be an easier way to achieve some result ..." there probably is. | 15:09 |
dcammue | x = 100 | 15:09 |
ubuntourist | dcammue, ha-ha. Yes, true. But I was trying to make a point about how multiplication was repeated addition. ;-) | 15:10 |
ubuntourist | Learn to search and read the Python Reference Manual. It can be hard to understand but it is a gold mine of | 15:11 |
ubuntourist | functions and objects that will make your code so much better. | 15:11 |
gabriel | didn't get | 15:12 |
ubuntourist | https://docs.python.org/3/py-modindex.html | 15:12 |
fkoikoi | i | 15:12 |
ubuntourist | https://docs.python.org/3/library/index.html | 15:12 |
*** fkoikoi has quit (Quit: Leaving) | 15:12 | |
gabriel | okay | 15:13 |
ubuntourist | gabriel, didn't get what? | 15:14 |
*** mulbah has quit (Remote host closed the connection) | 15:15 | |
ubuntourist | Anyway, I don't really have anything to say. | 15:15 |
ubuntourist | So, if no one has questions, I guess we are done for today... | 15:16 |
tboimah | okay thanks for today | 15:17 |
tboimah | It was real great | 15:17 |
tboimah | *really | 15:17 |
ubuntourist | Well, then. I will check in on Monday, but really, I won't have much to tell you. I'll just be available for questions. | 15:21 |
ubuntourist | Bye for now. | 15:21 |
*** ubuntourist has left #novawebdev (Leaving) | 15:21 | |
*** gabriel has quit (Quit: Leaving) | 15:55 | |
*** svaye has quit (Quit: Leaving) | 16:18 | |
*** fkoikoi has quit (Ping timeout: 480 seconds) | 16:19 | |
*** dcammue has quit (Ping timeout: 480 seconds) | 16:20 | |
*** mulbah has quit (Ping timeout: 480 seconds) | 16:20 | |
*** tboimah has quit (Ping timeout: 480 seconds) | 16:20 | |
*** shmohamud has quit (Remote host closed the connection) | 20:28 | |
*** shmohamud has quit (Ping timeout: 480 seconds) | 20:37 | |
*** shmohamud has quit (Ping timeout: 480 seconds) | 20:51 | |
*** shmohamud has quit (Ping timeout: 480 seconds) | 21:25 | |
*** shmohamud has quit (Ping timeout: 480 seconds) | 21:36 | |
*** shmohamud has quit (Ping timeout: 480 seconds) | 22:11 | |
*** shmohamud has quit (Ping timeout: 480 seconds) | 22:31 | |
*** shmohamud has quit (Ping timeout: 480 seconds) | 22:59 |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!