Working Of Python Engine
Introduction :
Python is a programming language used to develop applications and solve problems. The Python engine helps to run Python programs and gives the output.
Working of Python Engine :
1.First, we write the Python program in the editor.
2. Python reads the written code.
3. It checks whether the code has any syntax errors.
4. After checking, Python converts the code into bytecode.
5. The Python Virtual Machine executes the bytecode.
6. Finally, we get the output on the screen.
Example 1 :
a = 10
b = 20
c = a + b
print(c)
Output:
30
Explanation :
In this example, we take two variables, a and b. The values are 10 and 20. Python adds both values and stores the result in c. Finally, the print statement displays the output as 30.
Get Amanithota’s stories in your inbox
Join Medium for free to get updates from this writer.
Example 2 :
x = 5
y = 4
result = x * y
print(result)
Output:
20
Explanation:
First, we assign 5 to variable x.We assign 4 to variable y.Python multiplies both values.The result is stored in the result variable.Finally, Python displays 20.
Example 3 :
a = 1
b = 3
result = a + b
print(result)
Output:
4
Explanation:
First, we take two variables called a and b.We assign the value 1 to a.We assign the value 3 to b.Python adds both values.The result is stored in the result variable.Finally, the output is displayed as 4.
Conclusion :
Python engine makes the execution of Python programs easy. It reads the code, checks errors, converts it into bytecode and executes it to produce the output.







