How to compare the running efficiency of Python over that of C language
Today, I will talk to you about how to compare the running efficiency of Python with that of C language. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
Python is a very popular interpretive scripting language. C is a very popular compiled language. Because of its compiled nature, C is generally faster than Python, but it is lower-level. In contrast, Python programming is faster and easier. Translator's note: in the most authoritative ranking of TIOBE programming languages, Python ranks 6th and 2nd in terms of running efficiency and C, and second in scripting languages and compiled languages (PHP and Java, respectively).
The question is whether the extra time spent running the Python program (without input) is more cost-effective than C, and whether the time spent running is more important than programming time.
System program
I decided to set up a simple program that can handle the calculation of the following formulas:
{x + y = 14 {x ^ 2 + y ^ 2 = 100
I quickly wrote it in Python and found the answer. Then I translated it into C language. I know that the same program in C takes a little more efficient code than Python, but that's not what I noticed. Before we continue, let's look at the code:
Python: X = 1 while x