C language needs to master thousands of programming skills, in order to have some programming ideas to write some programs;
Python can write many programs with hundreds of programming skills. Jiaxing private Detective (http://user.qzone.qq.com/778601707)
For example, get a random number between [-80, 20]:
Python:
- Import random; random. Randrange(-up )
C:
- #include <stdio. h>
- #include <stdlib. h>
- #include <time. h>
- int main()
- {
- int Max =, min = -80;
- Srandom( (unsigned)time(NULL) );
- Long Rand = Random();
- /* 2 different methods Span style= "color: #0000ff;" >to generate -80 20< Span style= "color: #0000cc;" >) */
- float i = (Float) Rand / (Rand_max + 1< Span style= "color: #0000cc;" >.0) * (Max -min) + min//rational number
- int J = rand % (max -min + 1) + min; //integer
- printf("%f,%d\n", I, J);
- return 0;
- }
Until one day, the invention of a good toolbox, the situation has improved.
#include <signal.h>
- int Randrange(int start, int end)
- {
If(Start > End) {
Raise (SIGFPE);
}
- /* Generate random integer in [Start, end) */
- Srandom( (unsigned)time(NULL) );
- return random() % (end -start + 1) + start;
- }
- int Randint(int start, int end)
- {
- /* Generate random integer in [Start, end] */
- Return Randrange(start, end+1);
- }
Changsha private detective So, the C language learning curve is steeper than python, and you need to remember more tricks, and it takes longer to realize an idea and read a piece of code. The same working life, C language Master of the overall programming architecture and theoretical system will be much less than python. The same applies to the master. To replace C as the C + + principle.
What is the difference between the C language and python for programmers?