Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Easiest Language to Learn?  (Read 30931 times)

0 Members and 1 Guest are viewing this topic.

gh0std0g74



    Apprentice

    Thanked: 37
    Re: Easiest Language to Learn?
    « Reply #15 on: October 11, 2009, 08:28:45 PM »

    Well, from what I can tell, it takes a set of keys, and returns a set of values. (I forgot to transfer the lcase over, but  I suppose switching comparemodes would work.
    where did you get this Python code. I can tell you, it does nothing. If its going to translate , say letter "A" to "1", "B" to "2", then the string method str.translate() and str.maketrans() can be used.
    Also, the code is outdated. Nowadays, string.split(), string.lower() is not needed. You can simply say
    Code: [Select]
    >>> "ABC".lower()
    >>> var="myString"
    >>> var.lower()
    >>> var="mystring"
    >>> var.split()
    ['mystring']


    notice the above split() on "var" , it produces a list of one item because you are splitting on nothing. If you want to get individual characters into arrays,
    Code: [Select]
    >>> var="mystring"
    >>> list(var)
    ['m', 'y', 's', 't', 'r', 'i', 'n', 'g']
    Therefore, in your Python sample code, that split() is not doing anything useful.
    if you want to go over the individual characters in a string,
    Code: [Select]
    >>> for i in var:
    ...  print i
    ...
    m
    y
    s
    t
    r
    i
    n
    g

    there is no need to use range(0,len(words)).
    Also, the variables string, str, dict are all reserved words.

    BatchFileCommand



      Hopeful
    • Thanked: 1
      Re: Easiest Language to Learn?
      « Reply #16 on: October 12, 2009, 04:42:37 PM »
      My answer stands solid until proven otherwise, WITH VALID CODE!
      οτη άβγαλτος μεταφ βαθμολογία

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: Easiest Language to Learn?
      « Reply #17 on: October 12, 2009, 05:06:55 PM »
      My answer stands solid until proven otherwise, WITH VALID CODE!

      Right until proven wrong is the approach often taken by trolls.
      I was trying to dereference Null Pointers before it was cool.

      Helpmeh



        Guru

      • Roar.
      • Thanked: 123
        • Yes
        • Yes
      • Computer: Specs
      • Experience: Familiar
      • OS: Windows 8
      Re: Easiest Language to Learn?
      « Reply #18 on: October 12, 2009, 06:33:46 PM »
      Right until proven wrong is the approach often taken by trolls.
      So the justice system used by Canada and US is used by trolls?
      Where's MagicSpeed?
      Quote from: 'matt'
      He's playing a game called IRL. Great graphics, *censored* gameplay.

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: Easiest Language to Learn?
      « Reply #19 on: October 12, 2009, 06:36:49 PM »
      So the justice system used by Canada and US is used by trolls?

      *censored*?

      that's the opposite! the crown is assumed WRONG about the criminals guilt until they are able to prove it.
      I was trying to dereference Null Pointers before it was cool.

      Helpmeh



        Guru

      • Roar.
      • Thanked: 123
        • Yes
        • Yes
      • Computer: Specs
      • Experience: Familiar
      • OS: Windows 8
      Re: Easiest Language to Learn?
      « Reply #20 on: October 12, 2009, 06:47:29 PM »
      *censored*?

      that's the opposite! the crown is assumed WRONG about the criminals guilt until they are able to prove it.
      They assume defence is right (not guilty unless they confess) until proven wrong.
      Where's MagicSpeed?
      Quote from: 'matt'
      He's playing a game called IRL. Great graphics, *censored* gameplay.

      BatchFileCommand



        Hopeful
      • Thanked: 1
        Re: Easiest Language to Learn?
        « Reply #21 on: October 12, 2009, 06:54:16 PM »
        Quote
        Right until proven wrong is the approach often taken by trolls.

        The difference being that Trolls have been proven wrong.
        οτη άβγαλτος μεταφ βαθμολογία

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: Easiest Language to Learn?
        « Reply #22 on: October 12, 2009, 07:57:27 PM »
        The difference being that Trolls have been proven wrong.

        Wrong about what?

        your expression above is biassed, even ghostdog, I'm sure, can agree with that.

        Python is a great language (I'm sure, I would take some getting used to the use of whitespace as part of the syntax, being used to C/C++/C# where it's ignored, and VB where... well actually I suppose the use of CRLF to separate statements can be considered the use of whitespace too, come to think of it.) Readability is subjective, with any language.

        Speed- Python, being an interpreted language, will be slower then equivalent compiled code. On the other hand- the choice of algorithm is going to be the deciding factor in  any application of either compiled or interpreted language. As an example, you simply cannot optimize a bubble-sort in any compiled language to be faster then a quicksort- or really, any other sort algorithm, implemented in an interpreted language.

        Now, that being said; there are some critical differences between what Python is aimed at and the other languages you named are for.

        Each of the languages you named can create Windows Applications, C, BASIC (via freeBASIC or darkBASIC) and VB6 (which takes hacking to create a command-line program).

        Basically- Python is a scripting language- a Scripting language is intended for a completely different set of problems then a compiled language, mostly for the creation of helpful little utilities that are used at the command-line. Because of this (and correct me if I'm wrong) but Python- and most scripting languages - cannot be used to create a windows application, unlike the other languages you named.

        Also, regarding OOP once again... no one answered my question... is  each separate file in Python usable as a class? Do they posess member variables? (I see that the built-in stuff uses Objects with static methods, like "string.<method>" but is it possible to create your own objects?



        EDIT: Actually, I just remembered IronPython, which is a .NET implementation of Python... I imagine THAT can create windows applications


        Also, in answer to the query of where I got the code, I just did a google for python samples.

        ahh, here it is:

        http://www.strout.net/python/ai/therapist.py

        Something that might explain the inconsistencies with today's python:"last revised: 3/17/97", perhaps split did something different. I haven't a god *censored* clue. It's not my code, so I assumed it was there for a reason.



        To clarify what  that particular procedure did. you pass in a delimited string of keys and a dictionary, and you get a delimited string of the values in those keys. It seemed nice and short and easily translated to VB- or any language, for that matter.

        Wow, I missed an entire post here, too...

        BC_Programmer, you have obviously never used Python. For indentation, when using the IDLE or built in IDE it automatically indents when necessary. So you don't need to worry about indentation.
        That wasn't my point. my point was you cannot "organize" it the way you like- for example, with C you could put an entire IF statement on one line, if it was a line or two.

        Quote
        I'm sorry, it's dynamically typed I was thinking of something else.

        Well, as ghostdog pointed out, it's like the use of Variant's in Visual Basic before version 4 (that is, "2"+2 fires off a type mismatch in VB2- you would need to either val() the "2" or CStr/Str the 2. (IIRC, I do know that VB4 added "evil type coercion")... It was definitely better before they decided to add the automatic crap.

        Quote
        Not all Python programs have to be OO, which is better then everything being OO.
        not all VB6 programs have to be Object Oriented either. In fact even .NET programs don't strictly require Object Orientation(of them, C# does though... VB.NET does not) . Java strictly requires it.

        Quote
        Second of all, you put plenty of spaces in the VB6 code, but none in the Python code, making the Python code not look as nice.

        I only copy-pasted the Python code. The reason the VB6 code is indented as it is is because I wrote it. I didn't want to mess up the python code, which now turns out to be over 9 years old anyway (again, might explain the split?).
        Quote
        Third of all, BC_Programmer, stop acting like a smart-aleck:
        "smart alec"   :P

        Quote
        Not only that, but the Python and VB6 code don't even work the same.
        With the split statement you add a lower function to Python and make it look
        more complicated. Like before, you don't add any spaces, it's all clumped together.
        Yes, if the split function actually does split the string into it's respective characters, then it does work differently. I went with the assumption that the split() function defaulted to a space, or something along those lines. Otherwise- well, it just doesn't do a whole lot (did the Split() function perhaps work differently in 97?) Already covered the spaced issue, I don't have python installed and therefore would be unable to test and knowing that whitespace is part of the syntax I left it as-is.



        Quote
        Please BC, stop acting like an idiot.

        your the one comparing apples to oranges. Not me. Well, I was, but it was purely satirical.


        Quote
        Anyway, have you played with Python's dictionary objects? For example, how easy is it to sort dictionary items by keys or values in VB ?(or vbscript?) ... with Python's dictionary objects and sorting methods, its very easy. The last time i play with vb6, (or even vbscript), sorting dictionary objects (or even sorting ordinary variables) are a pain.

        I barely ever use Dictionary's in any language. I use the VB6 Collection Extensively, but I don't use the Dictionary object since it requires the scripting Run-time (which is guaranteed from VBScript, but not guaranteed to be installed with VB6) I rarely have to sort the items I have in the collection- since they are objects, and in general the order I have them in doesn't matter much. I believe the main thing that turned me off of the dictionary was the requirement of passing in a Key, rather then being able to use an index as is possible with a collection. Not a huge deal but enough of a down-side to not add the reference to the scripting runtime.

        For those times when I do need to sort, I just use a Class and interface I wrote- all I need to do is implement the comparing function that compares two items in the array. Haven't needed it much, come to think of it.

        I'm going to install a few scripting languages(perl,python, (any others anybody can think of? (that is, ones that work with the Scripting Host)) so that I can create some sample Python and Perl Scripts to go alongside the VBScript and Javascript ones I have already. I thought I already installed the two but I guess it was my old machine.







        [/quote]



        I was trying to dereference Null Pointers before it was cool.

        Helpmeh



          Guru

        • Roar.
        • Thanked: 123
          • Yes
          • Yes
        • Computer: Specs
        • Experience: Familiar
        • OS: Windows 8
        Re: Easiest Language to Learn?
        « Reply #23 on: October 12, 2009, 08:06:29 PM »
        Quote
        Third of all, BC_Programmer, stop acting like a smart-aleck:
        Quote
        Please BC, stop acting like an idiot.
        If these were by the same poster, then I find this funny. Otherwise, disregard this post.
        Where's MagicSpeed?
        Quote from: 'matt'
        He's playing a game called IRL. Great graphics, *censored* gameplay.

        gh0std0g74



          Apprentice

          Thanked: 37
          Re: Easiest Language to Learn?
          « Reply #24 on: October 12, 2009, 08:47:04 PM »
          Each of the languages you named can create Windows Applications, C, BASIC (via freeBASIC or darkBASIC) and VB6 (which takes hacking to create a command-line program).

          Basically- Python is a scripting language- a Scripting language is intended for a completely different set of problems then a compiled language, mostly for the creation of helpful little utilities that are used at the command-line. Because of this (and correct me if I'm wrong) but Python- and most scripting languages - cannot be used to create a windows application, unlike the other languages you named.
          scripting language or compiled language makes no real big difference in what its aimed to do. Besides, it also depends on what you mean by Windows applications.You can most certainly program windows applications using Python and GUI modules like wxPython or Tkinter to name a few. They are the same as what VB6 does, except that in VB6, you can drag and drop your buttons and place it nicely on your forms...etc..
          while in Python, say example if using plain old Tkinter, you have to code like this
          Code: [Select]
          Button(mybutton, text="Submit", command=mycommand_once_its_clicked)
          If you are talking about doing low level system programming like drivers etc, then its a different story.


          Quote
          Also, regarding OOP once again... no one answered my question... is  each separate file in Python usable as a class?
          Do they posess member variables? (I see that the built-in stuff uses Objects with static methods, like "string.<method>" but is it possible to create your own objects?
          Python is a OO language, therefore you can be rest assured that it does what it does, as an OO language. If you are talking about creating your own classes and methods, sure,you can.  You can also write your own collection of functions, for example
          Code: [Select]
          def function1() :
            # function to do task1
            return value1
          def function2() :
            # function to do task2
            return value2
          Save it as a file, say myfunc.py.  then from your main script, call it using import
          Code: [Select]
          import myfunc
          # main
          # start
          var = myfunc.function1() #call function1 from myfunc
          print var

          Quote
          Also, in answer to the query of where I got the code, I just did a google for python samples.

          ahh, here it is:

          http://www.strout.net/python/ai/therapist.py

          Something that might explain the inconsistencies with today's python:"last revised: 3/17/97", perhaps split did something different. I haven't a god <censored> clue. It's not my code, so I assumed it was there for a reason.
          well, as you can see , its rather old code. Python has come a long way since then. regex is deprecated and re is used instead, along with a few others. anyway, to digress................

          Quote
          Yes, if the split function actually does split the string into it's respective characters, then it does work differently. I went with the assumption that the split() function defaulted to a space, or something along those lines. Otherwise- well, it just doesn't do a whole lot (did the Split() function perhaps work differently in 97?)
          with split() in Python, you have to give it a delimiter.  if not, it will just not do anything. for example
          Code: [Select]
          >>> astring = "adbc"
          >>> print astring.split()
          ['adbc']
          >>> astring = "adbc,abcd"
          >>> print astring.split()
          ['adbc,abcd']
          >>> print astring.split(",")
          ['adbc', 'abcd']

          like i said in my previous post, if one want to "split" a word into individual characters , use list. continuing from above
          Code: [Select]
          >>> list(astring)
          ['a', 'd', 'b', 'c', ',', 'a', 'b', 'c', 'd']

          Quote
          I barely ever use Dictionary's in any language. I use the VB6 Collection Extensively, but I don't use the Dictionary object since it requires the scripting Run-time (which is guaranteed from VBScript, but not guaranteed to be installed with VB6) I rarely have to sort the items I have in the collection- since they are objects, and in general the order I have them in doesn't matter much. I believe the main thing that turned me off of the dictionary was the requirement of passing in a Key, rather then being able to use an index as is possible with a collection. Not a huge deal but enough of a down-side to not add the reference to the scripting runtime.
          well, putting yourself aside, there will be others who needs those capabilities, and VB(or vbscript) is still lacking things like a good sort function (correct me if i am wrong since i haven't touch VB6 since dinosaur times).

          Quote
          I'm going to install a few scripting languages(perl,python, (any others anybody can think of? (that is, ones that work with the Scripting Host)) so that I can create some sample Python and Perl Scripts to go alongside the VBScript and Javascript ones I have already. I thought I already installed the two but I guess it was my old machine.
          Perl and Python are 2 of the most common and widely used ones...so i suggest you stick to either or both of them...I am not sure what you mean by "works with scripting host" , but i can tell you they both have modules to do WMI and a bunch of other win32 stuffs.













          Geek-9pm


            Mastermind
          • Geek After Dark
          • Thanked: 1026
            • Gekk9pm bnlog
          • Certifications: List
          • Computer: Specs
          • Experience: Expert
          • OS: Windows 10
          Re: Easiest Language to Learn?
          « Reply #25 on: October 12, 2009, 08:59:39 PM »
          Quote
          Teach Yourself Programming in Ten Years
          Researchers (Bloom (1985), Bryan & Harter (1899), Hayes (1989), Simmon & Chase (1973)) have shown it takes about ten years to develop expertise in any of a wide variety of areas, including chess playing, music composition, telegraph operation, painting, piano playing, swimming, tennis, and research in neuropsychology and topology. The key is deliberative practice: not just doing it again and again, but challenging yourself with a task that is just beyond your current ability, trying it, analyzing your performance while and after doing it, and correcting any mistakes. Then repeat. And repeat again. There appear to be no real shortcuts: even Mozart, who was a musical prodigy at age 4, took 13 more years before he began to produce world-class music. In another genre, the Beatles seemed to burst onto the scene with a string of #1 hits and an appearance on the Ed Sullivan show in 1964. But they had been playing small clubs in Liverpool and Hamburg since 1957, and while they had mass appeal early on, their first great critical success, Sgt. Peppers, was released in 1967.  ...
          Peter Norvig
          http://norvig.com/21-days.html




          BC_Programmer


            Mastermind
          • Typing is no substitute for thinking.
          • Thanked: 1140
            • Yes
            • Yes
            • BC-Programming.com
          • Certifications: List
          • Computer: Specs
          • Experience: Beginner
          • OS: Windows 11
          Re: Easiest Language to Learn?
          « Reply #26 on: October 12, 2009, 09:17:08 PM »
          Quote
          scripting language or compiled language makes no real big difference in what its aimed to do.

          I have to disagree somewhat, while you CAN do any number of things, I wouldn't write a full-featured word processor in a scripting language any more then I'd fire up a C compiler to create a file size calculator(or something similar), or small simple GUI application.


          Quote
          Python is a OO language, therefore you can be rest assured that it does what it does, as an OO language. If you are talking about creating your own classes and methods, sure,you can.  You can also write your own collection of functions, for example

          but... err- what you used as an example is equivalent to a Visual Basic module, or Static class methods. What I wondered, was how one creates instances of objects in Python.


          Quote
          well, putting yourself aside, there will be others who needs those capabilities, and VB(or vbscript) is still lacking things like a good sort function (correct me if i am wrong since i haven't touch VB6 since dinosaur times).
          It doesn't come built-in, so I wrote a Module based iterative quicksort that simply compares with < and >, as well as (later) a class/interface based approach so I could sort different objects based on their properties and whatnot.

          Quote
          Perl and Python are 2 of the most common and widely used ones...so i suggest you stick to either or both of them...I am not sure what you mean by "works with scripting host" , but i can tell you they both have modules to do WMI and a bunch of other win32 stuffs.

          What I meant regarding "works with scripting host" is that it will work with CScript or WScript. For example- ActiveState Perl and ActiveState Python both expose their functionality to the scripting host; some other languages and implementations of languages don't. Main reason is because I use the scripts in my program by using the "ScriptControl" which doubtlessly accesses scripts via the Windows Script Host.
          I was trying to dereference Null Pointers before it was cool.

          Helpmeh



            Guru

          • Roar.
          • Thanked: 123
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Familiar
          • OS: Windows 8
          Re: Easiest Language to Learn?
          « Reply #27 on: October 12, 2009, 09:21:15 PM »
          Peter Norvig
          http://norvig.com/21-days.html




          In 4 years I've made the geekiest librarian at my school impressed with me....only because they don't teach programming at the elementary level. 
          Where's MagicSpeed?
          Quote from: 'matt'
          He's playing a game called IRL. Great graphics, *censored* gameplay.

          gh0std0g74



            Apprentice

            Thanked: 37
            Re: Easiest Language to Learn?
            « Reply #28 on: October 12, 2009, 10:27:40 PM »
            I have to disagree somewhat, while you CAN do any number of things, I wouldn't write a full-featured word processor in a scripting language any more then I'd fire up a C compiler to create a file size calculator(or something similar), or small simple GUI application.
            why not. see here.  considering the scale of those projects against a word processor, i don't see why a word processor cannot be done with Python.

            Quote
            but... err- what you used as an example is equivalent to a Visual Basic module, or Static class methods. What I wondered, was how one creates instances of objects in Python.
            i don't quite get what you don't get. see here for intro to classes. Basically to instantiate objects, the dot operator is used, much like Java. if you don't quite find what you are looking for, you can ask in comp.lang.python. I personally has limited (just the basics) OO knowledge.
            « Last Edit: October 13, 2009, 05:50:00 PM by gh0std0g74 »

            Geek-9pm


              Mastermind
            • Geek After Dark
            • Thanked: 1026
              • Gekk9pm bnlog
            • Certifications: List
            • Computer: Specs
            • Experience: Expert
            • OS: Windows 10
            Re: Easiest Language to Learn?
            « Reply #29 on: October 13, 2009, 11:26:47 AM »
            gh0std0g74
            Learn to test your links.
            Over 85% of coding is testing your code.  ::)