[13:45:04] [## Class Started at Mon Jul 8 13:45:04 2013 ##] [13:45:04] startclass [13:45:13] kushal, personally spoken it saddens me. Making mistakes is part of a learning process, of every learning process. But stubbornness seemingly prevents the learning effect from working. [13:45:26] dot|not, correct [13:45:31] ------SESSION STARTS---------- [13:45:34] ROLL CALL [13:45:35] dot|not, [13:45:38] puspita ghosh [13:45:39] Rahul Chowdhury [13:45:40] Elijah [13:45:41] iam_sudip [13:45:43] Pritha Ganguly [13:45:43] puja gupta [13:45:43] manish jain [13:45:44] Shantanu Sarkar [13:45:45] shantanu, thank you [13:45:47] Shalini Roy [13:45:48] supriya saha [13:45:49] Shungoh Kaetsu [13:45:49] anisha agrawal [13:45:49] sonam [13:45:54] ravi kumbhkar [13:45:55] Rashmi [13:45:55] avik ghosh [13:45:55] anurag kumar [13:45:57] Bidisha Mukherjee [13:46:08] Umesh Agarwal [13:46:12] amresh kumar [13:46:20] Christina Beemer [13:47:12] every one done ? [13:47:20] no [13:47:32] korak ghosh [13:47:33] Devyani [13:47:57] So first [13:48:19] We are slowly moving towards the pointed where only interested students will continue this training [13:48:25] s/pointed/point/ [13:48:26] What kushal meant to say was: We are slowly moving towards the point where only interested students will continue this training [13:48:28] ! [13:48:35] Christi123, ask [13:49:05] any other QA related to my email needs to be resolved after session among the students [13:49:05] kushal do we send the user name to you or users account. I am sorry if i am annoying [13:49:26] kavis [13:49:32] Christi123, sorry but your question does not make any sense. We will continue for now [13:49:43] today we will start with python [13:50:26] pingall: first tell me if you already any other programming language , tell me names in the message here , everyone [13:50:53] elita lobo [13:50:53] Hi, Josep Caselles here [13:51:24] strange no one is answering my question ? [13:51:27] C, C++, ASM, Java but forgot most of it. [13:51:28] C, C++, java, python [13:51:28] I know c, c++ and java [13:51:36] c, c++ , java,vb [13:51:38] Yes, C, C++, Java [13:51:40] C,C++, PHP, MATLAB, JAVA [13:51:43] c,c++ ,java [13:51:46] i know c,c++,Java [13:51:46] I know C++ basics, and java/android [13:51:47] fewcha, you are a mentor this year :D [13:51:47] c,c++,java [13:51:49] c,java,c++ [13:51:49] C, C++, java [13:51:50] C, C++ and little bit of python. [13:51:50] java,C [13:51:56] kushal: oops, sorry [13:51:57] (I hope I got "in the message here" right as "in this channel".) Programming experience in different languages of all kinds - From Python and Perl to Ruby and Shell to PHP and C, C++ Java and more exotic ones. But forgot most of it. [13:51:58] java and C [13:52:00] i know C only [13:52:00] C, C++, Java, Python [13:52:03] c , java [13:52:13] C [13:52:14] C, little Java [13:52:16] I know C only [13:52:18] c only [13:52:25] I know a little bit of c/c++. [13:52:25] java,c [13:52:26] c [13:52:39] anyone left ? [13:52:39] c only [13:52:46] lil bit of dot net and c# [13:53:11] C [13:53:48] * kushal is annoyed to see top posts in the replies again and again , in this case it is Christi123 [13:53:50] kavis: s/lil/little/ [13:54:05] praveenkumar, thanks [13:54:55] so today we will start with Python [13:54:58] sorry [13:55:05] every one open a terminal [13:55:33] type python and press enter [13:56:04] done [13:56:07] ^^ this command will start the python interpreter [13:56:19] kavis, stop typing unless asked [13:56:36] to exit from the interpreter press Ctrl + d [13:56:38] sorry [13:57:11] if anyone can not exit from the interpreter and say here now [13:57:20] if you can then do not type anything [13:57:49] good [13:58:31] so basically Python is an object oriented language [13:58:45] python command is actually the interpreter which we use [13:59:02] we can also compile any python code into bytecode to run in python vm [13:59:08] http://en.wikipedia.org/wiki/Bytecode [13:59:56] Guido van Rossum is the creator of Python [14:00:57] [OT] dell sent a wrong email once again [14:01:44] kushal: sorry. What is wrong in it? [14:01:58] dell, read my email and try to find out, I will not tell you [14:02:05] when we get into python interpreter it gives us a prompt with >>> [14:02:57] btw, http://www.flickr.com/photos/kushaldas/8609125454/in/set-72157633134565275 is Guido van Rossum [14:03:27] in the python interpreter we can write python statements [14:03:44] as usual our first example will be printing hello world [14:03:53] so type the following and press enter [14:04:05] print 'Hello World!' [14:04:17] tell me here if it does not work :) [14:05:16] going ahead [14:05:29] as you can see print statement is using to print a string [14:05:59] a string can be either using double or single quote [14:06:13] now print the same hello world example using double quoted string [14:06:30] and tell me done [14:06:33] done [14:06:36] done [14:06:36] done [14:06:38] done [14:06:39] done [14:06:44] done [14:06:44] done [14:06:46] done [14:06:46] done [14:06:46] done [14:06:46] done [14:06:47] done [14:06:47] done [14:06:48] done [14:06:49] done [14:06:52] done [14:06:53] done [14:06:54] done [14:07:07] Done. [14:07:07] done [14:07:08] done [14:07:09] done [14:07:21] done [14:07:26] done [14:07:33] Done [14:08:09] we can also use this interpreter as simple calculator [14:08:10] like [14:08:13] 2 + 10 [14:08:17] 7 * 6 [14:08:17] done [14:08:23] 50 / 10 [14:08:33] try those ^^ [14:08:44] done [14:08:46] done [14:09:29] done [14:09:35] done [14:10:00] done [14:10:33] done [14:10:47] done [14:11:02] done [14:11:10] done [14:11:19] I will continue [14:11:32] now python can handle bigger numbers too [14:12:02] ! [14:12:08] done [14:12:11] some thing like: 23234234 * 368746213874634243243454325 [14:12:16] Christi123, ask [14:12:46] kushal 25/2 gives me 12 the interpreter wont display the decimal part ? [14:12:51] [14:13:00] Because you gave it an integer. [14:13:05] Christi123, ^^ [14:13:08] So the return value is an integer too. [14:13:12] Christi123, try 25.0 / 2 [14:13:37] Kushal, Done :) [14:13:45] brb 2 minutes [14:13:48] dot|not, thanks :) [14:17:11] you can use arrow keys in the interpreter [14:18:06] next [14:19:02] a = 12 [14:19:04] kushal, ping [14:19:20] navid_, session is going on , what you want ? [14:19:36] kushal,sorry i had a network problem can you please repeat the tasks ? [14:19:47] korak_, no sorry [14:20:33] the above statement create a name called "a" and points it to a value 12 [14:20:42] s/create/creates/ [14:20:43] What kushal meant to say was: the above statement creates a name called "a" and points it to a value 12 [14:20:56] generally we call it a variable [14:21:35] we will go into details later [14:21:47] now in python we do not need to tell the data type [14:21:57] the interpreter will figure that out [14:22:28] so if I write name = 'Kushal Das' it will know name is a variable with string type [14:24:01] if I write value = 20 [14:24:16] then it will figure variable value is an integer [14:26:58] so if we do the following [14:27:03] value = 20.5 [14:27:06] value = 2- [14:27:10] value = 20 [14:27:22] value = 2- was typo, do not try that [14:27:29] value = "Kushal Das" [14:27:57] in all the above cases value holds the data we pass to it [14:28:12] to know the type of the variable write type(variable) [14:28:21] type(value) in this case [14:29:03] try it out [14:29:06] everyone [14:30:06] ! [14:30:12] kirk_iowa, ask [14:30:30] are there any such variables such as long, long long ? [14:30:44] kirk_iowa, there is long [14:31:00] kirk_iowa, try x = 23234234 * 3687462138746342432434543253 [14:31:05] and then type(x) [14:33:17] like any other programming language, we can write Python in a file and then execute that file later on [14:33:51] I will write the hello world example [14:34:15] python files end with .py extension [14:34:28] so $vim helloworld.py [14:34:42] #!/usr/bin/env python [14:34:43] print "Hello World!" [14:34:46] save and exit [14:35:43] get out of python first [14:36:15] then do that [14:36:15] ! [14:36:36] after you wrote that file , do $ chmod +x helloworld.py [14:36:46] and then [14:36:53] $ ./helloworld.py [14:36:58] rahulch, ask [14:37:18] what was the first line for? the one with "#!" [14:37:25] :) [14:37:45] we call it sha-bang. [14:37:50] google to learn more [14:38:06] kushal, ok [14:38:47] please try the above example [14:38:57] ! [14:39:21] ! [14:39:29] AndroUser2 is now known as tenstormavi [14:39:30] AndroUser2, ask (first tell your name) [14:40:00] korak, ask [14:40:11] Sorry i am avinash someone change my nick [14:40:53] What happens if we write python helloworld.py [14:41:06] Then the interpreter interprets your code. [14:41:20] s/interprets/interpretes/ [14:41:22] What dot|not meant to say was: Then the interpreter interpretes your code. [14:41:32] kushal,when will i have to write the line begining with'#' [14:41:41] korak, means ? [14:41:59] Then difference between chmod +x? [14:42:19] tenstormavi, man chmod [14:42:25] tenstormavi, ^^ [14:42:48] kushal'#!/usr/bin/env python [14:42:48] Kushal ok [14:43:24] korak, in the file named "helloworl.py" withopu quotes [14:43:36] s/withopu/without/ [14:43:37] What kushal meant to say was: korak, in the file named "helloworl.py" without quotes [14:43:50] eeks [14:43:55] helloworld.py [14:44:00] korak, ^^ [14:44:57] any more questions ? [14:45:30] I guess no [14:45:53] from now on everyone please create a directory named code inside your home directory [14:46:01] we will write all programs there [14:46:35] ! [14:46:58] puspita, ask [14:47:50] will that directory be inside root and then home? [14:48:13] puspita, no. [14:48:19] puspita, we use normal use accounts, not root [14:48:20] In your - as in your user - homedirectory. [14:48:30] ok thanks [14:49:07] now python is space sensitive [14:49:13] so if I write [14:49:23] >>> value = 12 [14:49:43] it will throw an error as I have given one extra space in the front [14:50:01] ^^ everyone try that now [14:50:45] ! [14:50:52] rahulch, ask [14:51:33] in the error, what does ' File "" ' mean ? [14:51:43] rahulch, google for stdin [14:52:22] ok [14:52:25] it is standard input [14:52:53] kushal, yes i know that [14:52:57] now if you see the error "IndentationError: unexpected indent" what you will understand from it ? [14:53:32] there is a problem with indentation i.e space [14:53:43] correct ^^ [14:53:44] tabs are also indentations [14:53:45] That there is a space somewhere [14:53:52] that i gave wrong indent as input [14:53:56] kushal, that means we must have given some unnecessary spaces somehwere [14:53:59] yes [14:54:05] Armageddon, yes [14:54:16] now remember from now on, do not mix tabs and spaces [14:54:30] in python always use 4 spaces as indentation [14:54:52] ! [14:54:57] in my vimrc file tab means 4 spaces [14:55:31] so if you use it then you already have 4 spaces as indentation [14:55:33] Christi123, ask [14:55:35] is it a convention to give 4 spaces [14:55:51] kushal, i understood :) [14:55:55] Christi123, yes [14:56:11] Now any like with # is a comment [14:56:16] # This is a comment [14:56:27] s/like/line/ [14:56:28] What kushal meant to say was: Now any line with # is a comment [14:56:39] a = 12 # here we assign 12 to a [14:57:09] comments are for human users who will read your code [14:57:35] so they are very important [14:58:45] always write as much comment as possible [14:58:56] s/comment/comments/ [14:58:57] What kushal meant to say was: always write as much comments as possible [15:00:07] korak_ is now known as korak [15:00:52] now there are few keywords which you should not use as variable names [15:01:00] and [15:01:00] as [15:01:00] assert [15:01:00] break [15:01:00] class [15:01:01] continue [15:01:02] def [15:01:04] del [15:01:06] elif [15:01:08] else [15:01:11] except [15:01:15] exec [15:01:16] finally [15:01:19] for [15:01:23] from [15:01:25] global [15:01:28] if [15:01:30] import [15:01:33] in [15:01:35] is [15:01:37] lambda [15:01:39] not [15:01:41] while [15:01:45] or [15:01:47] with [15:01:49] pass yield [15:01:53] print [15:01:55] raise [15:01:59] return [15:02:01] try [15:02:03] ^^ the keywords [15:03:13] now in a command line program you can take input from the user [15:03:27] we use raw_input function for the same [15:03:30] example below: [15:04:13] value = raw_input('Enter your name: ') [15:04:18] print value [15:06:14] now we will write a code which will take user's name as an input [15:06:42] and print the name twice as out put (in two different lines) [15:06:54] in a file called print_twice.py [15:07:48] do it inside that code directory [15:07:53] everyone ^^ [15:09:21] tell me when you are done [15:09:29] done [15:09:46] done [15:09:51] done [15:10:02] done [15:10:05] done [15:10:09] done [15:10:18] there is a problem with indentation i.e space [15:10:35] done [15:10:44] ? [15:10:52] typo [15:11:02] done [15:11:09] done [15:11:14] done [15:11:45] done [15:11:51] done [15:11:53] done [15:12:19] done [15:12:23] pdone [15:12:27] done... [15:12:29] typo [15:12:46] ! [15:12:55] s/pdone/done/ [15:12:56] What anwesha meant to say was: done [15:13:02] rahulch, ask [15:13:42] here is point [15:13:53] my print_twice.py has these lines- http://fpaste.org/23696/29575713/ , and i am getting this output- http://fpaste.org/23697/13732957/ [15:14:06] raw_input returns a string [15:14:52] can anyone help rahulch ^^ ? [15:15:48] anyone ^^ [15:15:51] rahulch, you forgot the sha-bang i guess [15:15:57] tutum, correct [15:16:11] rahulch, you forgot the sha-bang line [15:16:13] tutum, oh yes, sorry [15:16:16] kushal, tutum, thanks [15:16:21] #!/usr/bin/env python [15:16:34] rahulch, if you do not write that [15:16:42] then also you can run your code by [15:16:48] $ python print_twice.py [15:17:02] rahulch, ^^ try that [15:17:21] done [15:17:38] kushal, yes it works :) [15:17:47] so next step [15:18:03] in python we can assign more than one value in a statement [15:18:08] a , b = 10, 20 [15:18:21] and then print the values a and b :) [15:19:26] we can assign 3 values also [15:19:31] and so on [15:19:45] we can use this to swap two variable [15:19:47] a = 10 [15:19:50] b = 20 [15:21:26] fewcha_ is now known as fewcha [15:21:28] a, b = b, a [15:21:31] print a [15:21:33] print b [15:21:43] * J_Caselles applauds [15:21:55] :D [15:22:22] J_Caselles, coming from Java land this must be fund I guess ? :) [15:22:28] s/fund/fun/ [15:22:30] What kushal meant to say was: J_Caselles, coming from Java land this must be fun I guess ? :) [15:22:32] yeah haha [15:22:34] doing too many typos [15:23:52] now one can swap between any kind of variables or objects [15:24:08] in python everything is an object [note] [15:24:10] so [15:24:13] a = "Kushal Das" [15:24:15] b = 20 [15:24:19] a, b = b, a [15:24:23] print b [15:24:25] print a [15:24:48] ^^ everyone try that [15:25:48] tell me when you are done [15:25:53] done [15:25:54] done [15:25:55] done [15:25:56] Done. [15:25:58] done [15:25:58] done [15:26:04] done [15:26:04] done [15:26:06] done [15:26:08] done [15:26:09] done [15:26:11] done [15:26:13] done [15:26:13] done [15:26:14] done [15:26:15] done [15:26:15] done [15:26:17] done [15:26:20] done [15:26:24] done [15:26:25] done [15:26:51] done [15:26:56] done [15:28:20] done [15:28:26] done [15:29:01] http://kushaldas.in/tmp/pym.pdf is my book [15:29:30] read till 3rd chapter [15:29:38] try the examples [15:30:50] that is for tomorrow, you don't have to do it now [15:30:58] ! [15:31:21] Armageddon, ask [15:31:59] just an observation, right above 3.2 'India\'s best' could've been written easier "India's best" [15:32:04] [15:33:17] Armageddon, I am teaching escaping there [15:33:32] right, as I said, observation [15:34:04] Armageddon, ok :) [15:34:10] now for tonight's home task [15:34:25] if anyone is not replying to email properly, will not get any reply from me [15:34:39] so that is your fault if you do not receive any password [15:34:41] now [15:35:08] everyone make a directory in their git repo called intro [15:35:40] inside create a solution.rst which will contain your introduction and a few lines about what you think about this training [15:35:47] commit and push [15:36:01] and then use the submit_hometask command to submit to our server [15:36:11] DO NOT SUBMIT MORE THAN ONCE [15:36:13] ^^^ [15:36:38] submit_hometask -f path/to/the/rst/file -t "Introduction" [15:37:17] write the exact title I wrote [15:37:31] you can test your rst file using rst2html command and see how it looks [15:37:48] remember: you should not use double line bases titles [15:37:57] you should use something like [15:38:00] title [15:38:02] -------- [15:38:15] ^^^ that is how [15:38:24] any question ? [15:38:37] ! [15:39:05] puspita, ask [15:39:23] rst2html command always gives an error command not found [15:39:40] puspita, you never installed python-docutils package [15:40:09] http://www.dgplug.org/irclogs/2012/rst-primer/ is the rst tutorial [15:40:15] ! [15:40:21] Armageddon, ask [15:40:27] fewcha_ is now known as fewcha [15:40:34] I will reply to the emails after the session [15:40:39] do you want us to be honest about what we think ? [15:40:53] ! [15:41:01] Armageddon, yes, brutal truth, what ever you liked, what ever you did not [15:41:08] [15:41:08] ok i'll do that. thanks [15:41:16] kushal, works for me. thanks ^^ [15:42:17] Christi123, ask [15:42:19] What do you mean by "write the exact title I wrote" [15:42:58] Christi123, with -t we specify the title of the home task [15:43:20] kushal, ok thanks :) [15:43:23] Christi123, so write the exact title wrote [15:43:46] ! [15:43:54] tutum, ask [15:44:48] kushal,in this command "submit_hometask -f path/to/the/rst/file -t "Introduction"", in place of hometask do we have to write the name of our repo? [15:44:59] [15:45:36] tutum, no, that is the command we gave in the mailing list [15:46:02] okay ,thanks [15:46:31] any other question ? [15:46:34] anyone ? [15:47:29] ! [15:47:36] btw, I will only create the accounts for which I receive a proper reply by tomorrow afternoon 12pm IST [15:48:09] elita15, ask [15:49:10] should we give the submit_hometask command from our git repo? [15:49:36] [15:49:56] elita15, you can give from anywhere you want [15:50:05] just point it to the correct rst file [15:50:44] any other question ? [15:52:06] kushal, okay thanks. [15:55:24] ROLL CALL [15:55:33] Rahul Chowdhury [15:55:33] Anwesha Das [15:55:34] amresh kumar [15:55:37] Puspita Ghosh [15:55:39] Nilanjit Mitra [15:55:40] anisha agrawal [15:55:42] Rahul Mishra [15:55:45] Josep Caselles [15:55:46] Bidisha Mukherjee [15:55:48] Pritha Ganguly [15:55:49] iam_sudip [15:55:50] Shungoh Kaetsu [15:55:51] Priyanka Kotiyal [15:55:52] manish [15:55:52] sonam [15:55:53] Christina Beemer [15:55:53] Rashmi [15:56:20] anurag kumar [15:56:25] ------------SESSION ENDS---------- [15:56:30] endclass [15:56:30] [## Class Ended at Mon Jul 8 15:56:30 2013 ##]