Python Forum
different programming languages/words in text editors
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
different programming languages/words in text editors
#1
In programming,with your text editor is the language used like Python or C++ ,changing its language or word ( in itself, in the editor ) to a binary value and sending that binary value to the PC ,as you write program ?
I ask this because if it isn't doing this the computer would have to know more then necessary to to do its job with all the different words used . . . for example and this is just an example . . if APPLE is use in Python to tell the PC to display on screen , would APPLE be used in all the others ,like say C++ to display or would it be a totally different word like maybe PEAR in C++ , and as I am thinking ( hopefully not wrong ) it doesn't matter with word is used because in the programming software in text editor it is changed to a binary value ,if the word is APPLE or PEAR the programming software sends out the same binary value to the PC,for the program being written ?. And that is all that matters ,right ???

Al
Reply
#2
(Jul-02-2021, 09:10 PM)alok Wrote: In programming,with your text editor is the language used like Python or C++ ,changing its language or word ( in itself, in the editor ) to a binary value and sending that binary value to the PC ,as you write program ?
The question is somewhat strange,maybe because lack a little understanding how this work underneath.
The Editor just display code and has nothing to with the outcome,can throw away Editor and get same result from command line.

Lest say i use VS Code which is multi language Editor .
I use Code Runner then can turn to what used to run the code(from command line).
Python
print('hello world') 
Output:
[Running] C:\Python39\python.exe "g:\div_code\hello.py" hello world
C++
#include <iostream>
using namespace std;

int main() {
  cout << "Hello World!";
  return 0;
}
Output:
[Running] g++ -o hello "g:\div_code\hello.cpp" && hello Hello World!
JavaScript
console.log('Hello World');
Output:
[Running] node "g:\div_code\hello.js" Hello World
Python need to be interpreter(python.exe dos this).
C++ need to be compiled by a compiler in this case G++
JavaScript run in case with Node.js
The reason JavaScript is so popular ls that it also run in Browsers.
<!DOCTYPE HTML>
<html>
<body>
  <script>
    alert('Hello, world!');
  </script>
</body>
</html>

So in there a differed ways/steps to talk to computer which in the end only understand binary(01000100011).
Text Editor is only displaying the code,then underneath is interpreter(Python), compiler(C++), or eg Browser(JavaScript),
doing the to talk to computer in binary(01000100011).
Reply
#3
Your correct ! I don't really understand ,just trying to learn it. Do the different text editors use different code ( word to me ) to do the same thing ?
Then it ( the code ) goes to the interpreter ( for Python ) or compiler ( for C++) ,etc. and becomes THE SAME 1's & 0's for the PC to understand. Is the interpreter in the Python text editor and compiler in the C++ text editor ?
Like I said before in my strange example ,Python is using APPLE and C++ is using PEAR . . . to do the same thing . . . this is what is happening or are am I wrong . . . that different text editors use a different code ( word ) to have the PC do the same thing . . . then it goes to the PC as 1' & 0's combo ,doesn't matter if it is APPLE from Python or PEAR from C++, it comes out to lets say 10100001 if it is APPLE or PEAR.
My point is ,if I am correct . . . each text editor is using a different code or word to do the same thing . . .. because in the end it changes it to 1's and 0's,correct ? If I am correct. Why do different text editors use a different code or word to do the same thing?
Why don't all editors call it APPLE for a particular thing to happen ?
I add this because this is what I am asking - do different code text editors use different codes to do the same funtion? If so why ?
I appreciate your time on this, Thank You.
Al
Reply
#4
(Jul-03-2021, 04:14 PM)alok Wrote: Your correct ! I don't really understand ,just trying to learn it. Do the different text editors use different code ( word to me ) to do the same thing ?
Text Editors can only display code then underneath call eg interpreter(Python), compiler(C++) then show output in editor or command line,
depend on editor's.
That why you have to tell editors as example PyCharm where Python interpreters is placed as editors can not run code alone.

Here a run from commandline,see that work fine without any editors.
[Image: j4gfe6.png]
See also that C++ is a complier so it make a hello.exe

Quote:My point is ,if I am correct . . . each text editor is using a different code or word to do the same thing . . .. because in the end it changes it to 1's and 0's,correct ? If I am correct. Why do different text editors
As mention so do text editor nothing when it comes to run code,only display then call Interpreter(Python) or Compiler(C++) underneath.
Compiler vs Interpreter: Complete Difference Between Compiler and Interpreter
So if make no difference if word is APPLE or PEAR,different languages take different routes(not editors) down lowest level binary(01000100011).
Reply
#5
Thank You,as I said and from what you gave as demo ,to do the same function like Hello World , in Python , C++ or JavaScript, the three all use different code to produce the same outcome,correct ?
If I am correct ,why was this done this way ?
A person that learns say Python and knows nothing else would not be able to program with say JavaScript until he or she learned JavaScript ,correct ?
again Thank You for your time and helping,

Al
Reply
#6
Each programming language creator has decided how they want the user of their language to go about printing hello world.
The human-readable code that a user of a language wrote will be converted into something that the computer can understand by code that the creator of the language wrote.
Some programming languages are written in other programming languages like CPython is written in C.
Reply
#7
(Jul-04-2021, 05:15 PM)alok Wrote: Thank You,as I said and from what you gave as demo ,to do the same function like Hello World , in Python , C++ or JavaScript, the three all use different code to produce the same outcome,correct ?
If I am correct ,why was this done this way ?
Yes the produce the same output,but the usage languages can different task as eg JavaScript run mostly in Browser.
(Jul-04-2021, 05:15 PM)alok Wrote: A person that learns say Python and knows nothing else would not be able to program with say JavaScript until he or she learned JavaScript ,correct ?
If know Python then JavaScript is similar is not that big a difference.
If i just copy some JavaScript code from web.
function returnSum(first, second)
        {
          var sum = first + second;
          return sum;
        }
      var firstNo = 78;
      var secondNo = 22;
      console.log(firstNo + " + " + secondNo + " = " + returnSum(firstNo,secondNo));
Output:
78 + 22 = 100
Can easily write this in Python.
def return_sum(first, second):
    mysum = first + second
    return mysum

firstNo = 78
secondNo = 22
print(f'{firstNo} + {secondNo} = {return_sum(firstNo, secondNo)}')
Output:
78 + 22 = 100
So the output is the same.
JavaScript is popular for web-development as together with HTML/CSS it can use Brower for output.
So different langue can have different usage even it outcome is the same.
Reply
#8
Thank You both , Snippsat and Yoriz . . . for your help.
take care,
Al
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python vs low level languages, (say C++) astral_travel 1 189 Apr-07-2024, 01:22 AM
Last Post: PyDan
  Online Python Editors with Built-in Compilers Elon_Warner 0 649 Oct-04-2023, 08:35 PM
Last Post: Elon_Warner
  what stand-alone python-aware open-source editors are around? Skaperen 14 2,063 Jun-11-2023, 11:12 PM
Last Post: Skaperen
  Stanza: A Python NLP Library for Many Human Languages, by the Stanford NLP Group buran 0 1,763 Mar-26-2020, 05:36 PM
Last Post: buran
  Python editors srm 2 2,170 Mar-03-2020, 10:28 AM
Last Post: snippsat
  text editors with Python Skaperen 4 129,238 Dec-02-2019, 08:16 PM
Last Post: Larz60+
  Suggestions for a machine learning model for invoice processing multiple languages? animeshsarraf 1 2,123 May-26-2019, 04:43 AM
Last Post: heiner55
  Text Editors! TrueStudentOfPython 7 4,463 Nov-27-2018, 01:26 AM
Last Post: Larz60+
  [split] Python Editors Wiki Updates metulburr 0 2,569 Nov-09-2017, 06:47 PM
Last Post: metulburr
  configuration formats / languages Skaperen 24 11,487 Oct-17-2017, 02:08 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020