Does anyone here know PYTHON (the programming language) or any others?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sgreger1
    Member
    • Mar 2009
    • 9451

    #1

    Does anyone here know PYTHON (the programming language) or any others?

    I have decided I want to learn programming.

    I have chosen Python.

    Does anyone here program, particularly with Python? If so I have a few questions. Not sure if anyone here is a programmer but if I recall we have quite a few tech guys on here so there has to be at least a few
  • captncaveman
    Member
    • Jul 2008
    • 924

    #2
    Yes sir, i am a python programmer. What questions do you have?

    Comment

    • captncaveman
      Member
      • Jul 2008
      • 924

      #3
      Also C# C++ VB and Java. Any questions welcome

      Comment

      • precious007
        Banned Users
        • Sep 2010
        • 5885

        #4
        .html

        .php

        Comment

        • jagmanss
          Member
          • Jul 2010
          • 12213

          #5
          Oh! I got this...(&^$)*^)*I|(OG*R_&|

          Comment

          • EricHill78
            Member
            • Jun 2010
            • 4253

            #6

            Comment

            • captncaveman
              Member
              • Jul 2008
              • 924

              #7
              Originally posted by EricHill78
              Its the nerds that rule the world my good sir.

              Comment

              • GoVegan
                Member
                • Oct 2009
                • 5603

                #8
                I didn't know sgregor uses a pocket protector.

                Comment

                • captncaveman
                  Member
                  • Jul 2008
                  • 924

                  #9
                  Do you have ANY programming/scripting knowledge prior to making this awesome leap into python? Mind you from starting from scratch python is rather easy to pick up on, and MANY learning resources are free!

                  Comment

                  • sgreger1
                    Member
                    • Mar 2009
                    • 9451

                    #10
                    Originally posted by captncaveman View Post
                    Do you have ANY programming/scripting knowledge prior to making this awesome leap into python? Mind you from starting from scratch python is rather easy to pick up on, and MANY learning resources are free!
                    Man I love Snuson! You guys rock!



                    So here's the deal:


                    I have a new long term plan which is to learn programming and possibly transition into the IT industry. That is a long ways away though, I would like to start by learning PYTHON. I do not know any other programming languages and am a complete beginner. I have done html and such but that's about it, no actual real programming.


                    So here is the deal, this is my system:

                    Version: PYTHON 2.7.1 32 BIT for OS X 10.6.6

                    My operating system: OS X 10.6.6



                    I am reading a tutorial here, that has a script I want to run, but here's my problem, I CAN'T EVEN GET PAST THE FIRST STEP.


                    I can't even get anything to run in the damn interpreter! I can get it to do simple stuff that is 1 or two lines, but if I try running something from a tutorial I am using, it gives me errors. Here is what I am trying to run:

                    Code:
                    # Area calculation program
                    
                    print โ€œWelcome to the Area calculation programโ€
                    print โ€œโ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€
                    print
                    
                    # Print out the menu:
                    print โ€œPlease select a shape:โ€
                    print โ€œ1  Rectangleโ€
                    print โ€œ2  Circleโ€
                    
                    # Get the userโ€™s choice:
                    shape = input(โ€œ> โ€œ)
                    
                    # Calculate the area:
                    if shape == 1:
                        height = input(โ€œPlease enter the height: โ€œ)
                        width = input(โ€œPlease enter the width: โ€œ)
                        area = height*width
                        print โ€œThe area isโ€, area
                    else:
                        radius = input(โ€œPlease enter the radius: โ€œ)
                        area = 3.14*(radius**2)
                        print โ€œThe area isโ€, area



                    I can't get it to run. I open IDLE and try to copy/paste it and it just freezes. Then I try to go to File>Open and try opening a text file I saved as a .py file and it loads teh script and immediately freezes or shuts down unexpectedly.


                    Is IDLE something I have to use? If I just go to the "terminal" and type "Python" it loads python into the unix shell, and at least it doesn't freeze when I enter code, but when I copy/paste text from the tutorial (the code I posted above) into the interpreter it gives me the following error:


                    Code:
                    Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) 
                    [GCC 4.2.1 (Apple Inc. build 5664)] on darwin
                    Type "help", "copyright", "credits" or "license" for more information.
                    >>> # Area calculation program
                    ... 
                    >>> Welcome to the Area calculation programprint
                      File "<stdin>", line 1
                        Welcome to the Area calculation programprint 
                                 ^
                    SyntaxError: invalid syntax
                    >>> print 
                    
                    >>> print
                    
                    >>> 
                    >>> # Print out the menu:
                    ... Please select a shape:print
                      File "<stdin>", line 2
                        Please select a shape:print 
                                    ^
                    SyntaxError: invalid syntax
                    >>> 1  Rectangleprint 
                      File "<stdin>", line 1
                        1  Rectangleprint 
                                        ^
                    SyntaxError: invalid syntax
                    >>> 2  Circleprint 
                      File "<stdin>", line 1
                        2  Circleprint 
                                     ^
                    SyntaxError: invalid syntax
                    >>> 
                    >>> # Get the s choice:user
                    ... shape )= > input(
                      File "<stdin>", line 2
                        shape )= > input(
                              ^
                    SyntaxError: invalid syntax
                    >>> 
                    >>> # Calculate the area:
                    ... if shape == 1:
                    ...     height = Please enter the )height: input(
                      File "<stdin>", line 3
                        height = Please enter the )height: input(
                                            ^
                    SyntaxError: invalid syntax
                    >>>     width = Please enter the )width: input(
                      File "<stdin>", line 1
                        width = Please enter the )width: input(
                        ^
                    IndentationError: unexpected indent
                    >>>     area = height*width
                      File "<stdin>", line 1
                        area = height*width
                        ^
                    IndentationError: unexpected indent
                    >>>     The area , areaisprint 
                      File "<stdin>", line 1
                        The area , areaisprint 
                        ^
                    IndentationError: unexpected indent
                    >>> else:
                      File "<stdin>", line 1
                        else:
                           ^
                    SyntaxError: invalid syntax
                    >>>     radius = Please enter the )radius: input(
                      File "<stdin>", line 1
                        radius = Please enter the )radius: input(
                        ^
                    IndentationError: unexpected indent
                    >>>     area = 3.14*(radius**2)
                      File "<stdin>", line 1
                        area = 3.14*(radius**2)
                        ^
                    IndentationError: unexpected indent
                    >>>     The area , areaisprint 
                      File "<stdin>", line 1
                        The area , areaisprint 
                        ^
                    IndentationError: unexpected indent
                    >>>

                    So as can be seen it messes up the indents I guess and doesn't paste properly. Typing it out line by line doesn't work either.



                    How in the hell do I type code from the tutorial into the damn interpreter in a way that it will work like it is supposed to?


                    Thanks a lot in advance, you guys rock!



                    EDIT: I'm so excited that you know PYTHON!! I am so amped about finally learning programming which is something I have ALWAYS had an interest in. I chose PYTHON because it seems like the syntax would be easiest to pick up on, it seems powerful enough to do little beginner stuff (and advanced stuff it seems) and it comes with lots of free documentation.


                    What kind of programs can be made with PYTHON? I am not too familiar with the difference in the languages, but I was told that learning an object oriented language will help with developing good structure building habits so you write cleaner code or something, is this true? Either way, what kind of stuff is PYTHON capable of, do you have some example of programs/scripts that do cool stuff? I am at the part where I learn how to print "hello world" and calculate the area of a triangle and stuff lol. But i'm good with computer and if I can just get over this one hurtle I will be up and learning this thing in to time. I'm so AMPED! I havn't sat down to learn something new in a while and programming seems like something that I could really get into.

                    Comment

                    • sgreger1
                      Member
                      • Mar 2009
                      • 9451

                      #11
                      Originally posted by GoVegan View Post
                      I didn't know sgregor uses a pocket protector as a sex toy on my mom.
                      The more you know...

                      Comment

                      • captncaveman
                        Member
                        • Jul 2008
                        • 924

                        #12
                        Copy paste is your issue. The formatting form the copy paste IDLE and Terminal hates it, specifically the quotes. Ether copy paste into say a text editor save as .py. Open it up in IDLE. You will notice the words in the quotes will NOT be "green" thats that defualt color in unix/linux and windows i assume it will be the same in Mac. All you have to do is just erase the quotes and replace them. The save and either hit F5 or Run -> Run module.

                        You don't have to use IDLE i use eclipse as my main dev environment. http://www.eclipse.org/

                        If its freezing up or crashing i would either not use IDLE or reinstall it. Personally i would also to python 3 i prefer the syntax alot more but thats just me.

                        Comment

                        • captncaveman
                          Member
                          • Jul 2008
                          • 924

                          #13
                          As for some decent learning material for python take a look over here: http://learnpythonthehardway.org/index

                          What ever you can dream of you can build it in python. Websites, desktop applications games what have you it can be done. Before venturing off into the cool shit try to get some of the core or "basics" down... but the cool shit is damn tempting!

                          Since python has and always be open source decent free doc's and tutorials are out there. The community is awesome as well I haven't ran into too many python dicks that won't help a guy out... unlike the microsoft .net crowd.

                          Python is quite powerful and alot of engineers in the scientific communities use it alot for major projects (NASA).

                          Comment

                          • ratcheer
                            Member
                            • Jul 2010
                            • 621

                            #14
                            I was a programmer for many years and programmed in so many languages, I probably couldn't list them all. But, I've been retired for a year and a half, now, and there isn't much need to program at home. I want to become proficient in Ruby (I know the basics), but I just can't get inspired.

                            My favorite language of all time (that I used) is Smalltalk.

                            Tim

                            Comment

                            • truthwolf1
                              Member
                              • Oct 2008
                              • 2696

                              #15
                              Getting flashbacks of early html classe's. I hate code and think it is backwords to work that way as interactive designer but understand exactly why it is there. Visual authoring software has always made things much easier.

                              Anybody have any idea about this whole HTML 5 switchover that is supposedly going to takeover 2013?

                              I have already seen in the industry many who are switching out much of their flash already and I dont think it was because of early
                              iphones.

                              Comment

                              Related Topics

                              Collapse

                              Working...
                              X