CrazyEngineers
  • gautam.kolluru

    gautam.kolluru

    MemberJul 13, 2011

    Lets learn Python

    Recently i made myself exposed to python language courses on the internet & i found it to be the most flexible laguages i knew till date.... May be thats why its named 'Python'! The very First thing i understand about Python is demanding me to call it an 'iProgramming language', an intelligent Programming language 😉 .
    I feel that any person who loves programming must learn python to understand the answer for the question 'Why to learn Python?' & you know what it takes for an employee to learn something thats currently not necessary for his job... I believe learning together enhances ones ability in understanding things... I promise it would be asset for everyone who participates in this & finally, Python is very simple & easy yet VERY powerful language.
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • durga ch

    MemberJul 13, 2011

    Hey Gautam,

    I am in for this. I always wanted to learn another language , and was kind deciding between perl and python. Python as far as I know is totally flexible and as well used extensively in networking domain.
    Are you an expert at this? or you are suggesting a kind of online study group?
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 13, 2011

    Yeah... I am also in. I heard that the syntax in Python need to be well indented and the easiest one being the swapping of two numbers! 😀
    a,b = b,a
    Right?
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 15, 2011

    Apologise for my late response....

    Hi Durga,
    Iam not an expert at Python, but a very enthusiastic learner of the language because of which i wanted to us to start this an online study group, completely interactive.... let me explain you how...

    Hi Praveen,
    Yes, Praveen, coding in Python is simpler than many other languages and also highly powerful than many other languages...

    Study Plan:
    code.google.com/edu ...... in this website, you can find the online free tutorials on Python, one of the best to start with & 'A Byte of Python' the book that best suits a beginner available pdf copies for free.
    I feel all of us who wants to learn this language here..... can find sometime to watch the video or to read the pdf doc (it is just as advantageous as one finds time to learn more.....) and then discuss whatever one has learned that day, here. I feel that with this kind of a method a person can increase the speed at which he/she learns a language with a significantly improved efficiency.
    Any queries regarding anything on this topic, please ask.
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorJul 15, 2011

    @gautam: Cool Idea!
    I am with you on this.
    Let's start this from today itself.
    I am starting from this page: #-Link-Snipped-#

    @all CS/IT engineers and others interested in learning python, Join Us now! 😀
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 15, 2011

    Friends, what about Python for Dummies? Which is better? Dummies or Google Code?
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 16, 2011

    @praveenscience,
    I think we should get bounded to a fixed material to learn, i opted 'a byte of python' because, i was suggested by friend and also i liked the title. It explains that its for beginners in the language of computers.
    The video lectures provided by google univ were chosen just because we have no much of a choice. Also, one can find python tutorials in youtube.
    My point to start this is to learn the language how well possible.
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 16, 2011

    So shall we start Learning from today?
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 16, 2011

    Yea.,. Am ready and we will post our excercises too... 😀
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 17, 2011

    Introduction to 'Python':
    As mentioned in the earlier posts, Python is a programming language and the most simplest yet powerful and is a combination of both Procedure oriented & Object oriented approaches.

    Python is an Open Source software which makes its users free at distributing/sharing the software/source code also can be modified by individuals for their own purposes etc...

    Downloading Python: This should not be a problem since there is an official python website for downloading the software and for other supports according to the operating systems being used. The website is: <a href="https://www.python.org" target="_blank" rel="nofollow noopener noreferrer">Welcome to Python.org</a> .

    Python is an Interpreted language i.e., when a piece of python code is executed, unlike JAVA, python's 'interpreter' first converts it into the intermediate 'binary code' and then into the code that a particular system understands.

    'Features of Python':
    If you still have the question "Why Python?" in your mind....... you can find your answer here...

    1. Simple:
    To explain the simplicity of Python in english, it is "Reading a good python program feels almost like reading English language." To understand it, just type the below code in the python interpreter and check:
    3+4(press enter and check the result)
    a=6(press enter)
    a(press enter & check the result)
    i feel this explains you the simplicity of python the simplest way.

    2. Easy to learn:
    Learning python language is easy compared to many other languages for its simplicity in syntaxes.

    3. Free & open source:
    As mentioned earlier, python's feature of being free & open source has played the most vital role in the extensive development and portability of the language to many platforms.

    4. High- Level Language:
    Python is a high-level language which means that the user need not bother of the system constraints in writing a program.

    5. Portability:
    As mentioned earlier, Python's open source feature has made it to be portable for wide range of systems.

    6.Interpreted:
    Python is an interpreted language which means that, unlike C, C++, Java, Python does not use a compiler.
    The interpreter here itself converts the code written in high-level to an intermediate 'byte code' that can be further converted into a code that a system understands.

    7. Object oriented:
    Python is both procedure oriented & an object oriented language, i.e. it is a combination of both C & C++/Java, etc... the advantage is that it has a powerful & simplistic way of doing OOP.

    8. Extensible:
    This is a feature one likes a lot....
    code written in languages like C or C++ can be used in a python program providing various advantages like, the speed of execution of that particular code, provide security for that code, etc...

    9. Embeddable:
    converse to extensibility is also true... 😉
    i.e. python code can be added into C or C++ program giving it scripting capabilities.

    10.Extensive Libraries:
    Python's library is a huge repository/bank of extensible code.

    Any doubts, plz do post!
    Thank you.
    😀
    Are you sure? This action cannot be undone.
    Cancel
  • eternalthinker

    MemberJul 17, 2011

    [FONT=&quot]Byte of Python is the best place to start.[/FONT]
    [FONT=&quot]The Google tutorials also look good enough, but you can work more flexibly with the ebook I think.[/FONT]
    [FONT=&quot] [/FONT]
    [FONT=&quot]And as you learn more python, check out python recipes at <a href="https://code.activestate.com/recipes/langs/python/" target="_blank" rel="nofollow noopener noreferrer">Popular Python recipes « ActiveState Code</a>[/FONT]
    [FONT=&quot]These are some really nice practical applications of Python. You can share your own code snippets there if they're good and new 😀[/FONT]
    Are you sure? This action cannot be undone.
    Cancel
  • jerigarr

    MemberJul 17, 2011

    what other programming languages does python has common or similarity.?
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorJul 18, 2011

    I have just started running simple arithmetic calculation programs and I've realized how cool this language is.
    Where to start?
    Should we post start with strings?
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 18, 2011

    Lets start with knowing how to define the variables... Please someone say more about the indentation...
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 19, 2011

    Hi,
    You can compare any interpreted language with python, like lisp, haskell etc...
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 19, 2011

    Actually, i prefer moving ahead in a step by step procedure, also i wish that this thread should help anyone who wants to learn python though one checks this thread after a long time. What do you say?
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 19, 2011

    Guys!!! Lets start with the ABC of Python here... 😀
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberJul 19, 2011

    hmm, I have not yet started learning it. I have another prep going in parallel. I might be slow here. I suggest you guys or anyone as such, frame up a schedule and try learning smaller chunks . I will push as much as I can to be in sync with you guys.
    Is anyone (esp from CS) across the basic index (I am not asking details)???
    Gen when I do a study plan- I write the index down . It might sound funny, but that helps me in keeping track of what I have covered and then I revise seeing the index.
    Make an index of topics, see how much time each might consume . As well, decide if you will be going practise||theory or theory then practise.
    If anyone can post a shcedule it would be great. I have no clue what are the topics. In meantime if I myself find time- i will post the index here
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 19, 2011

    Rightly said Durga... Yeah, I will prepare one and post it here... BTW, we both have a similar way of planning studies... 😀
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 20, 2011

    I feel happy for your active participation in the thread guyz......😁

    regarding index, Praveenscience has mentioned that he would do that and coming to scheduling...... could someone help us with scheduling?

    Coming to learning procedure, i think it would be better to explain what we learn in the simplest way possible, highlighting all the vital points/areas with examples. And after the completion of one topic lets prepare our own ques and solve them as an assignment. something like one ques per user per topic, covering all the topics n some brain-teasing... i think in this way we can expose ourselves to most varied problem scenarios. 😀
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 20, 2011

    1. #-Link-Snipped-#
    2. #-Link-Snipped-#
    3. #-Link-Snipped-#
    4. #-Link-Snipped-#
    5. #-Link-Snipped-#
    6. #-Link-Snipped-#
    7. #-Link-Snipped-#
    8. #-Link-Snipped-#
    9. #-Link-Snipped-#
    10. #-Link-Snipped-#
    11. #-Link-Snipped-#
    12. #-Link-Snipped-#
    13. #-Link-Snipped-#
    14. #-Link-Snipped-#
    15. #-Link-Snipped-#
    This is the general index of the book "A Byte of Python!"
    Are you sure? This action cannot be undone.
    Cancel
  • Sahithi Pallavi

    MemberJul 20, 2011

    @gautam : We asked the Index just to list out the concepts and for better understanding and for easy revising the concepts. It will be so good if we can discuss all the concepts here itself instead of posting the links. Nice Initiative, So I can learn Python from our CEans 😀
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 20, 2011

    @Sahiti, my intention also was to mention the index. to save some time, i've just copied the index in the byte of python book website.......
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberJul 20, 2011

    @ gautam- thats enough dude.
    So getting to it- by this weekend - everyone will have puthon installed in thier computers ?

    PS:we will cover 3 chapters there 😁
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 20, 2011

    Hey same content is there in the Python in a Nutshell book right.. Nice... 😀
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorJul 22, 2011

    I think the introduction part is over.
    Let's head over to installation.

    For Windows Users:

    1. Download Python Release from here: #-Link-Snipped-#
    (Since we will be referring to Google Python class some times, download any version 2.4 or later.)

    2. Keeping the defaults intact, install by running the Python installer.

    3. Open notepad, type this program:

    import sys
    def main():
    print 'Hello there', sys.argv[1]
    if __name__ == '__main__':
    main()

    Save it by the name hello.py

    4. After this, open the command prompt.
    Find command prompt here:
    Accessories > Command Prompt, or type 'cmd' into the start>run.
    Use cd (change directory) command to move
    You should be able to run the hello.py python program by typing "python" followed by "hello.py"

    For example:

    python hello.py
    OR
    python hello.py akd

    Output should be: Hello World OR Hello akd

    5. Done. 😀
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 22, 2011

    Hi Abrakadabra,
    Below is the code you have put up.... i have a few doubts...

    def main():
    import sys
    def main():
    print 'Hello there', sys.argv[1]
    if __name__ == '__main__':
    main()

    What does "if __name__ == '__main__'; " stand for?
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorJul 22, 2011

    I read the documentation. And got the following answer:

    The
    if __name__ == "__main__"
    is used in Python so that our Python files can act as either reusable modules or standalone programs.

    Unlike other languages, there's no main() function that gets run automatically.
    The main() function is implicitly all the code at the top level. In this case, the top-level code is an if block.



    __name__ is a built-in variable which evaluate to the name of the current module. However, if a module is being run directly (as in hello.py above), then __name__ instead is set to the string "__main__". Thus, you can test whether your script is being run directly or being imported by something else by testing

    if __name__ == "__main__":

    ...
    If that code is being imported into another module, the various function and class definitions will be imported, but the main() code won't get run.

    PS: Please correct me if I am wrong in the interpretation.
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 22, 2011

    Why did you use two def main(): statements?
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 22, 2011

    And I am using a Portable Python to work on. Whenever I start the program, it takes me to the >>> prompt. How to run .py files here? 😐
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberJul 22, 2011

    @ praveen

    you might want to refer this page :
    #-Link-Snipped-#

    it clearly states the method to run the *.py files.


    PS: apart from the link provided by AKD (official python link) , this link directs to direct FTP of the .msi executable. For those who have not yet downloaded for windows, this is a direct path for the file. (32 bit)
    #-Link-Snipped-#
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 22, 2011

    @Durga: The problem is, I am unable to install anything in my system. 😔 So, I took a portable version from <a href="https://portablepython.com/" target="_blank" rel="nofollow noopener noreferrer">Portable Python</a> 😀 Now I have no idea how to run .py files in this... 😐
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 22, 2011

    Regarding the execution of external python files:
    python helloworld.py

    But in case of portable stuff, what is the procedure? There's no python executable file. And I cannot install things. 😔
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberJul 23, 2011

    @ praveen .

    if you are in python IDLE , the click file and then 'new'.
    you should be able to see 'run' , or another shortcut keyboard key is 'f5' is you already have a.py file

    py
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 23, 2011

    Hey wow, where's this interface from? Well, lemme show you mine...
    [​IMG]
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 25, 2011

    @praveen,I think the interface Durga is using is from official python website, you can get it from <a href="https://www.python.org" target="_blank" rel="nofollow noopener noreferrer">Welcome to Python.org</a> . Anyways, i don't know how to run a file in Portable python but the procedure to run a python prog from command prompt is same as any other language prog, i mean to say, if you are not able to use it from portable python then its actually a good practice to use it from CMD. By the way, why are you not able to install any program in your windows?
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 25, 2011

    please be quick posting any queries regarding installation of python software in your computers so that we can start taking a 'byte' from it... 😀
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 25, 2011

    The option is disabled for me. I cannot and not supposed to install new software. Let it be a thumb rule 😛
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 25, 2011

    @praveen, nice to know that... 😉anyways, shall we start proceeding into some python???
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 25, 2011

    How to run a Python Program:There are 2 good ways of running a python program:Running from the command prompt:Step 1: Write the program in any editor (even in Notepad) and save it in a folder in the hard disk.Step 2: according to different operating systems being used, use the commands to go to the specifiic folder in which the python program you want to run is stored.Step 3: enter a command: python filename.py command line argumentsRunning from an editor:There are many python programming IDEs one can find in the internet. Few of them are listed below:1. Python IDLE. can be found in #-Link-Snipped-#. Django. Can be downloaded from #-Link-Snipped-#. ActivePython. download link: #-Link-Snipped-# procedure for most of the editors is similar:Iam using Python IDLE and will discuss the procedure for it.Step 1: Open the editor. going from Start-> Programs-> Python-> IDLE for Windows users, open from applications menu for Ubuntu Linux users.Step 2: Go to file tab in the taskbar (for both opening an existing file or to make a new file)Step 3: A new window pops up, displaying an already written python code for those who has opened an existing python program file or the same window displays a blank screen with cursor blinking for writing a new program.Make your necessary changes or write your program and save it in a folder in the systemStep 4: In the taskbar present in the popped up window where you can read or write your program, you can find the 'Run' tab which gives you the different option you want to do with the program. Click on the 'Run Module' or 'Run' sub-tab. And the result is displayed in the main window that has the python prompt '>>>'. PS: Anyone using a different IDE also please explain the running or executing procedure of a python program in your editor.Thankyou.
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 25, 2011

    /home/sai/Desktop/Screenshot-2.pngPython main IDE/home/sai/Desktop/Screenshot-3.pngNew Window for writing the actual file.
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 25, 2011

    Please post your queries if any, in the execution of a python program.Tomorrow we shall learn about Python: Basics i.e. Literals Constants, Numbers, Strings etc... Shall see you again tomorrow.Thank you.
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 25, 2011

    @Gautam: What have you posted till now? 😲
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 25, 2011

    @praveen, after how long are visiting the forum?..... 😛
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 25, 2011

    Not that. Your last three posts were totally unformatted and can't understand anything.
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 25, 2011

    @praveen, Its ok. i understand that, but i guess the problem is with my browser, Chromium for Ubuntu Linux which is not supporting the Advanced formatting options of the forum.....
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 25, 2011

    Atleast you could have given some line breaks right? Its all totally crowded... 😔
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 25, 2011

    Ofcrs, i've given line breaks...... but, even that didn't work!
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 25, 2011

    Try to disable the new WYSIWYG Editor and try. It is there in General Settings, at the end. 😀
    Are you sure? This action cannot be undone.
    Cancel
  • gautam.kolluru

    MemberJul 26, 2011

    Haven't found that option dude...
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 26, 2011

    See the last option... 😀

    Miscellaneous Options
    Message Editor Interface:
    • Enhanced Interface - Full WYSIWYG Editing
    • Basic Editor - A simple text box
    • Standard Editor - Extra formatting controls
    When posting messages to the forums or other members, there are three interface types available to you. The simplest of these is a simple text box, while the last is a fully-fledged WYSIWYG editor, which allows you to format your text as you want it and see the results immediately.

    Depending upon the capabilities of your web browser, you may not be able to use all of these options. If you experience problems when posting messages, try switching to a different interface type.
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 26, 2011

    Okay... Back to our topic... 😀

    Simple Mathematics Operations

    [B]Addition[/B]
    >>> 1 + 1
    2
    >>> 60+40
    100
    
    [B]Subtraction[/B]
    >>> 7-5
    2
    >>> 18-9
    9
    
    [B]Multiplication[/B]
    >>> 6*5
    30
    >>> 8*2
    16
    
    [B]Exponents[/B]
    >>> 5**2
    25
    >>> 8**3
    512
    Do check out these and say how it works... 😀
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 26, 2011

    Division Stuffs

    >>> 10/5
    2
    
    >>> 10/3
    3
    
    >>> 10.0/3.0
    3.3333...
    In this case, it takes a float values. 😀

    String Stuffs

    >>> print "1 + 2 gives the result ", 1 + 2
    1 + 2 gives the result 3
    
    >>> print "one megabyte is 2^10 kilobytes, or", 2**10, "kilobytes"
    One megabyte is 2^10 bytes, or 1024 kilobytes
    
    You can print sums and variables in a sentence. The commas seperating each section are a way of separating between values and expressions that you are printing.
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 26, 2011

    Table 1 - Python operators
    [TABLE="class: TableBody"]
    [TR]
    [TD="bgcolor: skyblue"]command[/TD]
    [TD="bgcolor: skyblue"]name[/TD]
    [TD="bgcolor: skyblue, width: 25%, "]example[/TD]
    [TD="bgcolor: skyblue, width: 25%, "]output[/TD]
    [/TR]
    [TR]
    [TD]+[/TD]
    [TD]Addition[/TD]
    [TD]4+5[/TD]
    [TD]9[/TD]
    [/TR]
    [TR]
    [TD]-[/TD]
    [TD]Subtraction[/TD]
    [TD]8-5[/TD]
    [TD]3[/TD]
    [/TR]
    [TR]
    [TD]*[/TD]
    [TD]Multiplication[/TD]
    [TD]4*5[/TD]
    [TD]20[/TD]
    [/TR]
    [TR]
    [TD]/[/TD]
    [TD]Division[/TD]
    [TD]19/3[/TD]
    [TD]6[/TD]
    [/TR]
    [TR]
    [TD]%[/TD]
    [TD]Remainder[/TD]
    [TD]19%3[/TD]
    [TD]5[/TD]
    [/TR]
    [TR]
    [TD]**[/TD]
    [TD]Exponent[/TD]
    [TD]2**4[/TD]
    [TD]16
    [/TD]
    [/TR]
    [/TABLE]
    Are you sure? This action cannot be undone.
    Cancel
  • vikas.chandra93

    MemberJul 26, 2011

    hey dudes.....im a ece student......do i have any use of python language??????? i knoe only c language cn i learn python of my own????
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 26, 2011

    vikas.chandra93
    hey dudes.....im a ece student......do i have any use of python language??????? i knoe only c language cn i learn python of my own????
    I am not so sure about your usage in career. Being an ECE Student, what if you got placed in a Software Company? 😛 Things happen... 😀 Yeah, you can learn, but it is better to have a good understanding of programming concepts, as you know C, that shouldn't be a problem! 😀
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberJul 27, 2011

    ">>> 10/3
    " reminds me of matlab. SO are we headint to operatiors and basics this weekend or you guys have advanced ahead?
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 27, 2011

    durga
    ">>> 10/3
    " reminds me of matlab. SO are we headint to operatiors and basics this weekend or you guys have advanced ahead?
    I have no idea... I am just sharing what I am learning.. 😛 Self learning stuff... Guess that works for group too... What say?
    Are you sure? This action cannot be undone.
    Cancel
  • eternalthinker

    MemberAug 4, 2011

    I just wrote some python code for FLAMES as discussed in #-Link-Snipped-#thread 😀
    (With the correction mentioned #-Link-Snipped-#)

    This uses some python data structures and all, which is not yet discussed in here.
    However, hope this will serve as an example of how short python codes can be 😉
    (I wrapped it around PHP tags so as to highlight string and common keywords)

    # FLAMES by Rahul Anand
    flames = ['Friend''Love''Affection''Marriage''Enemy''Sibling']
    name1 raw_input("Enter the first name: ").upper().replace(" ","")
    name2 raw_input("Enter the second name: ").upper().replace(" ","")

    for 
    letter in name1:
        if 
    letter in name2:            
            
    name1 name1.replace(letter''1)
            
    name2 name2.replace(letter''1)
    count len(name1) + len(name2)    
    if 
    not count: print "All letters cancelled. Cannot count!"

    pos 0
    while(len(flames)!=1):        
        
    pos = (count + (pos if pos!=-else 0)) % len(flames) - 1                    
        flames
    .pop(pos)    
    print 
    "Your relationship: "flames[0]
    This works for Python 2.x; Python 3 will require small syntax changes, for example, in reading input
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberAug 5, 2011

    eternalthinker
    I just wrote some python code for FLAMES as discussed in #-Link-Snipped-#thread 😀
    (With the correction mentioned #-Link-Snipped-#)

    This uses some python data structures and all, which is not yet discussed in here.
    However, hope this will serve as an example of how short python codes can be 😉
    (I wrapped it around PHP tags so as to highlight string and common keywords)

    # FLAMES by Rahul Anand
    flames = ['Friend''Love''Affection''Marriage''Enemy''Sibling']
    name1 raw_input("Enter the first name: ").upper().replace(" ","")
    name2 raw_input("Enter the second name: ").upper().replace(" ","")

    for 
    letter in name1:
        if 
    letter in name2:            
            
    name1 name1.replace(letter''1)
            
    name2 name2.replace(letter''1)
    count len(name1) + len(name2)    
    if 
    not count: print "All letters cancelled. Cannot count!"

    pos 0
    while(len(flames)!=1):        
        
    pos = (count + (pos if pos!=-else 0)) % len(flames) - 1                    
        flames
    .pop(pos)    
    print 
    "Your relationship: "flames[0]
    This works for Python 2.x; Python 3 will require small syntax changes, for example, in reading input
    Wow!!! Looks so small!!! Great!!! 😀
    Are you sure? This action cannot be undone.
    Cancel
  • eternalthinker

    MemberAug 6, 2011

    praveenscience
    Wow!!! Looks so small!!! Great!!! 😀
    Power of Python 😀
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberNov 9, 2011

    alright fellas!
    where are we at this :-s

    I bought the headsonfirst series for python and skimming through in freetime. smooth as cream as of now, but i have completed only chapter 1 (intro to lists, recursion and functions).

    *sorry for riddled language, I dont know why have been speaking this ay since few days*
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorNov 9, 2011

    @durga: Please get us started on this. Let's have separate threads for individual topics & exercises related to them.
    We can use this thread hereafter for indexing those threads.
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberNov 9, 2011

    I will try, but I guess the quality of content to be only of amatuer level :-| as I am too getting used to it.
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberNov 10, 2011

    AbraKaDabra
    I think the introduction part is over.
    Let's head over to installation.

    For Windows Users:

    1. Download Python Release from here: #-Link-Snipped-#
    (Since we will be referring to Google Python class some times, download any version 2.4 or later.)

    2. Keeping the defaults intact, install by running the Python installer.

    3. Open notepad, type this program:

    import sys
    def main():
    print 'Hello there', sys.argv[1]
    if __name__ == '__main__':
    main()

    Save it by the name hello.py

    4. After this, open the command prompt.
    Find command prompt here:
    Accessories > Command Prompt, or type 'cmd' into the start>run.
    Use cd (change directory) command to move
    You should be able to run the hello.py python program by typing "python" followed by "hello.py"

    For example:

    python hello.py
    OR
    python hello.py akd

    Output should be: Hello World OR Hello akd

    5. Done. 😀
    I have installed python i am able to run simple operation

    But on running above program i am getting indentation error , what can be the reason?

    Is it because of quotes problem in
    print 'hello'
    Are you sure? This action cannot be undone.
    Cancel
  • Vanessalee

    MemberNov 10, 2011

    Hey,
    I am an PHP developer but i do not have any knowledge about Python so can you give me a link for and online guide which provide good knowledge about Python?
    I want my #-Link-Snipped-#,#-Link-Snipped-# site convert from php into Python
    Thanks in advance
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberNov 10, 2011

    Vanessalee
    Hey,
    I am an PHP developer but i do not have any knowledge about Python so can you give me a link for and online guide which provide good knowledge about Python?
    I want my #-Link-Snipped-#,#-Link-Snipped-# site convert from php into Python
    Thanks in advance
    Read this thread my mate, there is enough material available here, i must say i have just started following this thread and now i can code in python
    Are you sure? This action cannot be undone.
    Cancel
  • Adivy

    MemberNov 10, 2011

    I wanted to learn Perl.Any of the CEans who can guide me or who is interested in Perl?? or Python is better than Perl? One of my trainer suggested to try reading the book -Learning Perl (the camel book)
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorNov 10, 2011

    @goyal:

    Yes, not working at my end either. 😐

    This works:

    import sys
    
    
    # Define a main() function that prints a little greeting.
    def main():
     
     # Get the name from the command line, using 'World' as a fallback.
    
      if len(sys.argv) >= 2:
        name = sys.argv[1]
      else:
        name = 'World'
      print 'Hello', name
    
    
    # This is the standard boilerplate that calls the main() function.
    
    if __name__ == '__main__':
      main()
    
    
    
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberNov 10, 2011

    @ goyal:

    Pyhton doesnot have braces to define a section , there needs to be proper indentation, for example
    when you write a if loop, it needs to be

    if <condition>

    <TAB space><conditon statement 1>

    <TAB space><condition statement 2>

    <tab space><tab space>if <condition>
    <tab space><tab space><tab space> <condition statement 1>
    its upto user to make sure the indentation in place here. I believe this operation can be switched off as well, but I still yet to know
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberNov 10, 2011

    anyway , Looking forward to something interesting in python, i read some where in this thread it is widely used in network programming

    Very much anxious to learn these things 😀
    Are you sure? This action cannot be undone.
    Cancel
  • Rupam Das

    MemberNov 10, 2011

    learn Python with Visual Studio.Net 2010

    Ok Python is quite an Old language which is used in Graphics Programming, Internet Programming. It was mainly developed for Unix Platform as a GUI programming Environment like QT Designer, Glade etc.

    As Microsoft has made Mono platform ( a .net environment for Unix) almost fully functional one, Python is made available with .Net and is called IronPython.

    Why you should Learn Python?

    a) Easy
    b) Platform Independent Code
    c) Can be used for both System Programming and Application Development
    d) Supports Graphics and Multimedia
    e) Ease of learning ( it is like C)
    f) Script ( No compiler is needed) Scripts can be executed directly from Shell also.

    I have been writing a Python tutorials for easy understanding. You can read it if you are willing to learn python in a week.
    #-Link-Snipped-#
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberNov 10, 2011

    Re: learn Python with Visual Studio.Net 2010

    Rupam Das
    f) Script ( No compiler is needed) Scripts can be executed directly from Shell also.

    [/QUOTE

    I didn't get this point, can you please ellaborate
    Are you sure? This action cannot be undone.
    Cancel
  • Rupam Das

    MemberNov 10, 2011

    I didn't get this point, can you please ellaborate
    Actually goyal, A Scipt is like a command to the kernel. For example shell script. A Scripting Language is like a batch file and each instructions are command. So Python commands, you can type directly in the shell like print "hello", and it will execute.
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberNov 10, 2011

    "As Microsoft has made Mono platform ( a .net environment for Unix) almost fully functional one, Python is made available with .Net and is called IronPython."

    I did not get this point, does it mean that python for MS is ironpython? hmm, i thought python is python for both unix and windows 😀
    Are you sure? This action cannot be undone.
    Cancel
  • Rupam Das

    MemberNov 10, 2011

    You are right to some extent, Python is Python for Both Windows and Uniz, Python that is capable of using .net Libraries is Iron Python. 😀
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberNov 12, 2011

    hello people

    found this useful resource which gives a visualization of execution of a piece of python code.

    #-Link-Snipped-#
    Are you sure? This action cannot be undone.
    Cancel
  • vinci

    MemberNov 13, 2011

    well i just read the last post here and found it very easy to initiate .thats the symptom of a good language
    Are you sure? This action cannot be undone.
    Cancel
  • Carl

    MemberFeb 11, 2012

    It's so great to see so many enthusiasts of the most powerful programming language ever (according to me and a couple of friends). It encompasses numerous applications to real life problems.
    The secrets to become an expert python programmer are:

    1. An analytical concise book
    (I suggest 'Starting Out With Python'. It worked wonders for me. It teaches computer science concepts as well as python programming.)

    2. Solve real life problems.
    (With just basic knowledge in python, you could write a program to solve most
    problems or make life easier for you.
    Examples are programs to keep track of your scores, calculate monthly spending and savings, and many more. All this can be done and more with just a basic knowledge of variable assignment and functions. Imagine what you can do if you proceed further. We are limited only by our imagination.

    3. Search for python code on the net and peruse.
    It motivates and gives a sense of fascination that just a few lines of code could work such wonders.

    4. Teach someone.
    No matter how little you know of the language, try explaining the concepts to anyone who wants to
    listen. You get a grasp of the concepts when you hear them coming out of your mouth.

    These have helped me in my python journey ( which is far from over ) and i hope it will help others as
    well.
    Thanks for your time.
    Are you sure? This action cannot be undone.
    Cancel
  • eternalthinker

    MemberMar 7, 2012

    Just felt like sharing a code snippet here.
    I was reading about functional programming paradigms in Python (the stuff that you'll find in LISP), and came across many interesting uses of them.

    Here's a wonderful example of implementing quicksort using the Python lambda construct.
    IN A SINGLE LINE:

    qsort lambda lst lst if len(lst) <= else qsort([for i in lst[1:] if lst[0]]) + [lst[0]] + qsort([for i in lst[1:] if >= lst[0]])
    Now just call qsort(list) 😀

    I think this implementation is even more consise than LISP. And a lot more readable!
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberAug 22, 2012

    ok,, something too basic here.I am looking for difference between input() and raw_input() functions?
    By the way - codecademy python lessons seems to ahve a bug in them. Just can't go beyond execrise three.
    EDIT:I am using py 2.7.
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberAug 22, 2012

    ok, I think it has to do with the return types. The confusion arised as raw_input() no longer exists in py3 and the functionality has been inculcated in input() of pyv3.
    But there is input() in pyv2 as well, which evaluates the input and kind returns a numeric value (?).
    I found this interesting link --> #-Link-Snipped-#
    Are you sure? This action cannot be undone.
    Cancel
  • ravi sidhu

    MemberAug 26, 2012

    Thanks its use full information about python have python Windows mobile
    Are you sure? This action cannot be undone.
    Cancel
  • ravi sidhu

    MemberAug 26, 2012

    Have python on windows mobile Samsung omnia
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register