A programming language is a system of notation for writing computer programs. It is described in terms of syntax and semantics. (Wikipedia)
Adaptadness, performance, ease of use, community, etc.
Many very simple rules make reading source code easier:
Coding norms may vary from one language to another.
The code does not respect the syntax of the language.
# The string to manipulate s = "IMT Atlantique" # Loop to append to a new string result = "" for i j in range(len(s)): result = s[i] + result
Error line 6:
SyntaxError: invalid syntax
The code is syntactically correct but produces an error during execution.
# Ask user at runtime for a value den = input("Please enter the value of the denominator") # Perform a computation result = 42 / den print(result)
Will generate a division by zero runtime error if den == 0.
den == 0
When using random values, the program may not always produce the same result. Thus, it may be difficult to debug.
However, it is possible to set a seed to ensure reproducibility.
# Needed imports import random # Set the seed random.seed(42)