What is the difference between the C language and python for programmers?

Source: Internet
Author: User

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:

    1. Import random; random. Randrange(-up )

C:

  1. #include <stdio. h>
  2. #include <stdlib. h>
  3. #include <time. h>

  4. int main()
  5. {
  6. int Max =, min = -80;
  7. Srandom( (unsigned)time(NULL) );
  8. Long Rand = Random();

  9.     /* 2 different methods Span style= "color: #0000ff;" >to generate -80 20< Span style= "color: #0000cc;" >) */
  10.     float i = (Float) Rand / (Rand_max + 1< Span style= "color: #0000cc;" >.0) * (Max -min) + min//rational number
  11. int J = rand % (max -min + 1) + min; //integer
  12. printf("%f,%d\n", I, J);
  13. return 0;
  14. }

Until one day, the invention of a good toolbox, the situation has improved.

  1. #include <signal.h>

  2. int Randrange(int start, int end)
  3. If(Start > End) {

    Raise (SIGFPE);

    }


  4. /* Generate random integer in [Start, end) */
  5. Srandom( (unsigned)time(NULL) );
  6. return random() % (end -start + 1) + start;
  7. }

  8. int Randint(int start, int end)
  9. {
  10. /* Generate random integer in [Start, end] */
  11. Return Randrange(start, end+1);
  12. }




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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.