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
|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 = name def update_id(self, id): self.id = id s = Student(5, "abc") print(s.id, s.name) s.update_id(10) print("New ID:", s.id)
View all Courses