Right now, Python and JavaScript are two of the most popular coding languages. The former is the dominant language of Artificial Intelligence, while the latter is used mostly for web development.
Both of these languages are interpreted languages, meaning that they do not need to be compiled and translated into machine code before execution. Instead, they are read and executed line by line, without any pre-processing. This means that both languages have the same performance.
Below are the basic syntactic differences between the two languages:
The new-line character \n indicates the end of a single line of code |
---|
A semicolon ; marks the end of one line of code |
---|
Only an indentation can indicate the start and end of a code block (i.e. start of a class, function etc.) |
---|
Code blocks are represented by the curly brackets {} |
---|
class Student:def __init__(self, id, name):self.id = id;self.name = namedef update_id(self, id):self.id = ids = Student(5, "abc")print(s.id, s.name)s.update_id(10)print("New ID:", s.id)
Free Resources