Lets learn Python

gautam.kolluru
@gautamkolluru-EtR8DB β€’ Oct 26, 2024

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

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • durga ch

    @durga-TpX3gO Jul 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?

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 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?

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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.

  • Ankita Katdare

    @abrakadabra Jul 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! πŸ˜€

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 15, 2011

    Friends, what about Python for Dummies? Which is better? Dummies or Google Code?

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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.

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 16, 2011

    So shall we start Learning from today?

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 16, 2011

    Yea.,. Am ready and we will post our excercises too... πŸ˜€

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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.
    πŸ˜€

  • eternalthinker

    @eternalthinker-Kvsi5Y Jul 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]

  • jerigarr

    @jerigarr-7ezGt0 Jul 17, 2011

    what other programming languages does python has common or similarity.?

  • Ankita Katdare

    @abrakadabra Jul 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?

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 18, 2011

    Lets start with knowing how to define the variables... Please someone say more about the indentation...

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 19, 2011

    Hi,
    You can compare any interpreted language with python, like lisp, haskell etc...

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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?

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 19, 2011

    Guys!!! Lets start with the ABC of Python here... πŸ˜€

  • durga ch

    @durga-TpX3gO Jul 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

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 19, 2011

    Rightly said Durga... Yeah, I will prepare one and post it here... BTW, we both have a similar way of planning studies... πŸ˜€

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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. πŸ˜€

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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!"

  • Sahithi Pallavi

    @sahithi-oJZaYj Jul 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 πŸ˜€

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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.......

  • durga ch

    @durga-TpX3gO Jul 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 😁

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 20, 2011

    Hey same content is there in the Python in a Nutshell book right.. Nice... πŸ˜€

  • Ankita Katdare

    @abrakadabra Jul 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. πŸ˜€

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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?

  • Ankita Katdare

    @abrakadabra Jul 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.

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 22, 2011

    Why did you use two def main(): statements?

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 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? 😐

  • durga ch

    @durga-TpX3gO Jul 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-#

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 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... 😐

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 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. πŸ˜”

  • durga ch

    @durga-TpX3gO Jul 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

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 23, 2011

    Hey wow, where's this interface from? Well, lemme show you mine...
    [​IMG]

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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?

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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... πŸ˜€

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 25, 2011

    The option is disabled for me. I cannot and not supposed to install new software. Let it be a thumb rule πŸ˜›

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 25, 2011

    @praveen, nice to know that... πŸ˜‰anyways, shall we start proceeding into some python???

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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.

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 25, 2011

    /home/sai/Desktop/Screenshot-2.pngPython main IDE/home/sai/Desktop/Screenshot-3.pngNew Window for writing the actual file.

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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.

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 25, 2011

    @Gautam: What have you posted till now? 😲

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 25, 2011

    @praveen, after how long are visiting the forum?..... πŸ˜›

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 25, 2011

    Not that. Your last three posts were totally unformatted and can't understand anything.

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 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.....

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 25, 2011

    Atleast you could have given some line breaks right? Its all totally crowded... πŸ˜”

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 25, 2011

    Ofcrs, i've given line breaks...... but, even that didn't work!

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 25, 2011

    Try to disable the new WYSIWYG Editor and try. It is there in General Settings, at the end. πŸ˜€

  • gautam.kolluru

    @gautamkolluru-EtR8DB Jul 26, 2011

    Haven't found that option dude...

  • PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jul 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.