----BEGIN CLASS---- [13:32] #startclass [13:32] Roll call [13:32] Naman Sharma [13:32] Shiva Saxena [13:32] Sahil [13:32] Prashant Sharma [13:32] Shaikh_farhan [13:32] Sehenaz Parvin [13:32] Jagannathan Tiruvallur Eachambadi [13:32] Shruti Dash [13:33] Robin Schubert [13:33] Mayank Singhal [13:33] Shital Mule [13:34] Manank Patni [13:34] pooja sulakhe [13:34] Anu Kumari Gupta [13:38] Nabarun Pal [13:39] 6 people [13:39] Anyone else? [13:39] Okay, questions? [13:39] on pyl chapters we read so far? [13:39] nope [13:40] kushal, I assume it was PYM. [13:41] Roll call: Neeraj Kumar Arya [13:41] Bhavesh Gupta [13:42] Devesh Verma [13:42] cypher01, that shows how sleepy I am :( [13:42] cypher01, yup, PYM or LYM [13:42] Are we given some task to do ? [13:42] Last time I have asked people to read about strings. [13:42] Everyone read about strings? [13:43] yes [13:43] yes [13:43] yes [13:43] yes [13:43] yes. [13:43] yes [13:43] yes [13:43] yes [13:43] s = "This is a long sentence in a small IRC chat over dgplug." [13:43] Yes [13:43] If I ask you to find the biggest word in that sentence, can you all do that? [13:44] do not search for the answer, if you need help, do help(str) to read the docs [13:46] yes [13:46] yes [13:47] yes [13:49] yes [13:50] Please write that code. [13:53] and show us when you are done. [13:54] kushal, done [13:54] ananyo, okay, wait for 5 minutes [13:54] kushal, ok [13:54] just queue yourself by typing ! [13:54] ! [13:55] ! [13:55] ! [13:55] ! [13:56] ! [13:57] ! [13:57] next [13:58] ananyo, show us your answer. [13:58] https://dgplug-ananyo2012.notebooks.azure.com/nb/notebooks/words_length.ipynb [13:59] next [13:59] https://dgplug-storymode7.notebooks.azure.com/nb/nbconvert/html/summertraining.ipynb?download=false [14:00] storymode7, fancy [14:00] next [14:00] sorry, just the ugly one-liner version ;) [word for word in s.split() if len(word) == max(map(len, s.split()))] [14:01] hehe [14:01] next [14:01] kushal: :P [14:01] https://notebooks.azure.com/akshayg96/libraries/dgplug18/html/summertraining.ipynb [14:01] I am trying to see if anyone did a simple one. [14:01] a simple for loop type :) [14:02] I thought of doing that but was too enamored to use max [14:03] kushal: akshayg96 did [14:04] schubisu, yup, finally [14:04] next [14:04] https://0x0.st/sJSi.py [14:04] akshayg96, yay for simplicity [14:04] :) [14:04] j605, I will not click on that .py url :) [14:04] it is just text [14:04] next [14:04] https://notebooks.azure.com/anu020815/libraries/dgplug18/html/summertraining.ipynb [14:04] ! [14:04] j605, let me try on Tor [14:05] it is like saying I will not click on ipynb urls :P [14:05] next [14:05] https://dgplug-shivasaxena.notebooks.azure.com/nb/notebooks/largest_word.ipynb [14:05] j605, both are different, I can trust Azure notebooks. [14:07] shiva, that is the wrong input. [14:07] next [14:07] wait. [14:09] kushal, sorry. Just corrected. [14:09] s = "https://notebooks.azure.com/anu020815/libraries/dgplug18/html/summertraining.ipynb" [14:10] tell me the name of the actual notebook filename from s. [14:10] you can type the answer here directly :) [14:10] s.split('/')[-1] [14:10] s.split("/")[-1] [14:11] summertraining.ipynb [14:11] :D [14:11] xD [14:12] s.split('/')[-1] [14:12] s.split('/')[-1] [14:13] (s.split('/')[-1]).split('.')[-2] [14:14] ann, smart :) [14:15] Roll Call: Aman Garcha [14:15] anyone else? [14:15] https://dgplug-inquiridortechie.notebooks.azure.com/nb/notebooks/summertraining.ipynb [14:16] s.rpartition('/')[2] [14:16] @kushal ,sorry could not be here from last 20 days, was busy with college [14:16] https://dgplug-gutsytechster.notebooks.azure.com/nb/notebooks/biggest_word.ipynb [14:16] romeo: please don't talk during the session. That is very impolite [14:17] romeo, okay, no issues. [14:17] storymode7, why? [14:17] sorry for being late. It took me more time to think about it. :| [14:17] storymode7, why 2? [14:17] kushal: 0: string before '/' 1: '/' 2: string after '/' [14:18] j605, i didn't know a session is going on sorry [14:18] storymode7, what if I change the url/ [14:18] https://example.com/asfda/asdfasfd/asdfasfda/asfdsafdsa/fsafdfsadf/file.ipynb ? [14:19] kushal: works [14:19] storymode7, here logic is filename present at the end of the string. [14:20] Sorry, does my solution misses something? [14:20] I actually don't even know what is rpartition [14:21] kushal: seems to be similar to rsplit [14:21] schubisu, Okay :) [14:21] Everyone already gave the solution that I came up with a little late. So I went for help(str) to find something similar. [14:21] storymode7, Okay [14:21] storymode7, it is okay to be same : [14:21] :) [14:22] s.rsplit('/')[-1] [14:22] How to create/write a multiline string? [14:22] kushal: okay, thanks :) [14:22] """ """ [14:22] ''' ''' [14:23] what is that? :) [14:23] oops sorry [14:23] ''' ''' [14:23] ann, you were also correct [14:23] by using triple quotes ''' [14:23] Yes [14:23] '''\nThis is a multiline string\n''' [14:23] """ """ [14:23] man-jain, yup [14:23] triple single/double quotes [14:24] oops. I must've written more. [14:24] Any more questions on strings? [14:24] or else I will give a problem to solve. [14:26] ! [14:26] next [14:27] I cannot understand the difference between rsplit() and split() and rpartition(). [14:29] Who wants to answer ann? [14:29] anyone? [14:30] ddg says there is just a fractional difference in performance which is negligible. Can I get some use cases? [14:30] ann it's the amount of elements that are present in the list. for *split and rpartition [14:30] ann: what is your exact question: understanding what it is or performance characteristics? [14:31] ! [14:32] ! [14:32] j605 use case and performance characteristics if there is. [14:32] Can someone please example what is rsplit and what is split? [14:32] ann: the 'r' is for 'right side'. rpartition and rsplit split the string at the most right occurrence of the split pattern. split returns left and right portion, rpartition returns the split pattern inbetween [14:32] If I'm correct rsplit split will generate n element list for n words in a string. rpartition generates a tuple with 3 elements. [14:33] ann: `split` will split the string at _every_ occurrence by default, not just the most right one [14:34] Thank you schubisu storymode7 [14:34] ann, If you try s.rsplit('/', 2) and s.split('/', 2) in Python interpreter. You will get difference between split() and rsplit() [14:35] The difference between rsplit and split comes into picture when we specify the maxsplit parameter with a value other than the default(-1). [14:36] ok akshayg96 palnabarun [14:36] rsplit will start splitting from right. And split from left. [14:37] like in https://dgplug-storymode7.notebooks.azure.com/nb/nbconvert/html/scratchpad.ipynb?download=false [14:41] Okay, here is the problem. [14:41] https://dgplug.org/irclogs/2018/Logs-2018-07-13-13-29.txt put the text in a variable, and then find out who spoke how many lines? [14:42] use the standard data structures. [14:42] rollcall: Pranjal Aswani. Sorry for being late. [14:43] Roll call: Pooja Kumari Singh [14:55] https://playground-palnabarun.notebooks.azure.com/nb/notebooks/play.ipynb [14:56] I will end here. ----END CLASS----