Special Python and special Python

Source: Internet
Author: User

Special Python and special Python

Before learning python, I also learned C, C ++, Java, PHP, javascript, and front-end. However, during the course of studying Python, I feel more or less the difference and particularity of Python in terms of syntax.

Today, let's talk about the syntaxes in Python that have aroused our curiosity.

1. NotesIn general, C, Java, PHP, and so on. In general, comments are annotated using //, but in Python, # is used for comments. I feel the high-end Python!

Oh, by the way, the version I used here is 3.6.0, which is a little different from the previous version. It is different from everyone else. Please be careful!

From the above, we can see that only 123 is output in the 123 #123 result, but not in the later part. Here # is the comment function, so that subsequent code will not be executed, regard it as nothing!

 

2. Power: Have you ever thought about how to express the 2nd power in C! How do I express the power of 6 to the power of 666! In python, it is extremely simple. That is, 2 ** 23 and 6 ** 666. in python, x ** y represents the power of y. I was so excited when I saw this! The following is the calculation result. You can give it a try! Trembling!

3. python doesn't end with ";". For me who are used to using C and PHP, this is simply against humanity! But there is no way. This is what people do.

4. python uses indentation to differentiate code blocks. Generally, it uses four spaces as the standard.

See it. No curly braces or semicolons appear at all ("{}",";")

Now, let's talk about it today, and then share more in-depth knowledge with you. These are prepared for the beginners!

Goodbye. See you later!

 

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.