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

  • durga ch
    durga ch
    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?
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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?
  • gautam.kolluru
    gautam.kolluru
    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.
  • Ankita Katdare
    Ankita Katdare
    @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! 😀
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Friends, what about Python for Dummies? Which is better? Dummies or Google Code?
  • gautam.kolluru
    gautam.kolluru
    @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.
  • gautam.kolluru
    gautam.kolluru
    So shall we start Learning from today?
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Yea.,. Am ready and we will post our excercises too... 😀
  • gautam.kolluru
    gautam.kolluru
    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: Welcome to Python.org .

    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.
    😀
  • eternalthinker
    eternalthinker
    [FONT="]Byte of Python is the best place to start.[/FONT]
    [FONT="]The Google tutorials also look good enough, but you can work more flexibly with the ebook I think.[/FONT]
    [FONT="] [/FONT]
    [FONT="]And as you learn more python, check out python recipes at Popular Python recipes « ActiveState Code[/FONT]
    [FONT="]These are some really nice practical applications of Python. You can share your own code snippets there if they're good and new 😀[/FONT]
  • jerigarr
    jerigarr
    what other programming languages does python has common or similarity.?
  • Ankita Katdare
    Ankita Katdare
    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?
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Lets start with knowing how to define the variables... Please someone say more about the indentation...
  • gautam.kolluru
    gautam.kolluru
    Hi,
    You can compare any interpreted language with python, like lisp, haskell etc...
  • gautam.kolluru
    gautam.kolluru
    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?
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Guys!!! Lets start with the ABC of Python here... 😀
  • durga ch
    durga ch
    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
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Rightly said Durga... Yeah, I will prepare one and post it here... BTW, we both have a similar way of planning studies... 😀
  • gautam.kolluru
    gautam.kolluru
    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. 😀
  • gautam.kolluru
    gautam.kolluru
    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!"
  • Sahithi Pallavi
    Sahithi Pallavi
    @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 😀
  • gautam.kolluru
    gautam.kolluru
    @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.......
  • durga ch
    durga ch
    @ 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 😁
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Hey same content is there in the Python in a Nutshell book right.. Nice... 😀
  • Ankita Katdare
    Ankita Katdare
    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. 😀
  • gautam.kolluru
    gautam.kolluru
    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?
  • Ankita Katdare
    Ankita Katdare
    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.
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Why did you use two def main(): statements?
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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? 😐
  • durga ch
    durga ch
    @ 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-#
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    @Durga: The problem is, I am unable to install anything in my system. 😔 So, I took a portable version from Portable Python 😀 Now I have no idea how to run .py files in this... 😐
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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. 😔
  • durga ch
    durga ch
    @ 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
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Hey wow, where's this interface from? Well, lemme show you mine...
    [​IMG]
  • gautam.kolluru
    gautam.kolluru
    @praveen,I think the interface Durga is using is from official python website, you can get it from Welcome to Python.org . 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?
  • gautam.kolluru
    gautam.kolluru
    please be quick posting any queries regarding installation of python software in your computers so that we can start taking a 'byte' from it... 😀
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    The option is disabled for me. I cannot and not supposed to install new software. Let it be a thumb rule 😛
  • gautam.kolluru
    gautam.kolluru
    @praveen, nice to know that... 😉anyways, shall we start proceeding into some python???
  • gautam.kolluru
    gautam.kolluru
    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.
  • gautam.kolluru
    gautam.kolluru
    /home/sai/Desktop/Screenshot-2.pngPython main IDE/home/sai/Desktop/Screenshot-3.pngNew Window for writing the actual file.
  • gautam.kolluru
    gautam.kolluru
    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.
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    @Gautam: What have you posted till now? 😲
  • gautam.kolluru
    gautam.kolluru
    @praveen, after how long are visiting the forum?..... 😛
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Not that. Your last three posts were totally unformatted and can't understand anything.
  • gautam.kolluru
    gautam.kolluru
    @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.....
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Atleast you could have given some line breaks right? Its all totally crowded... 😔
  • gautam.kolluru
    gautam.kolluru
    Ofcrs, i've given line breaks...... but, even that didn't work!
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Try to disable the new WYSIWYG Editor and try. It is there in General Settings, at the end. 😀
  • gautam.kolluru
    gautam.kolluru
    Haven't found that option dude...
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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.
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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... 😀
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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.
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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]
  • vikas.chandra93
    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????
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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! 😀
  • durga ch
    durga ch
    ">>> 10/3
    " reminds me of matlab. SO are we headint to operatiors and basics this weekend or you guys have advanced ahead?
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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?
  • eternalthinker
    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
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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!!! 😀
  • eternalthinker
    eternalthinker
    praveenscience
    Wow!!! Looks so small!!! Great!!! 😀
    Power of Python 😀
  • durga ch
    durga ch
    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*
  • Ankita Katdare
    Ankita Katdare
    @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.
  • durga ch
    durga ch
    I will try, but I guess the quality of content to be only of amatuer level :-| as I am too getting used to it.
  • Manish Goyal
    Manish Goyal
    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'
  • Vanessalee
    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
  • Manish Goyal
    Manish Goyal
    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
  • Adivy
    Adivy
    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)
  • Ankita Katdare
    Ankita Katdare
    @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()
    
    
    
  • durga ch
    durga ch
    @ 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

    <conditon statement 1>

    <condition statement 2>

    if

    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
  • Manish Goyal
    Manish Goyal
    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 😀
  • Rupam Das
    Rupam Das
    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-#
  • Manish Goyal
    Manish Goyal
    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
  • Rupam Das
    Rupam Das
    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.
  • durga ch
    durga ch
    "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 😀
  • Rupam Das
    Rupam Das
    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. 😀
  • durga ch
    durga ch
    hello people

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

    #-Link-Snipped-#
  • vinci
    vinci
    well i just read the last post here and found it very easy to initiate .thats the symptom of a good language
  • Carl
    Carl
    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.
  • eternalthinker
    eternalthinker
    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!
  • durga ch
    durga ch
    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.
  • durga ch
    durga ch
    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-#
  • ravi sidhu
    ravi sidhu
    Thanks its use full information about python have python Windows mobile
  • ravi sidhu
    ravi sidhu
    Have python on windows mobile Samsung omnia

You are reading an archived discussion.

Related Posts

Can anyone help me out with this question:- Design a circuit that takes a serial data stream from data in input.The output of the circuit is high if data in...
Jst help me in suggestion a good electronics project.
CAN anyone please tell me a good project on rail carriage and wagon . please its urgent😭
1. The Countess dressed with a (an) ____ elegance which seemed to proclaim to the world just how distinguished she was. A. studied 
B. pronounced 
C. ingenuous 
D. understated 
E....