Function call & built-in functions

Source: Internet
Author: User

A function is a code block that can implement specific functions. When we call a function, our dream goes into reality, and the function will be implemented. In all programming languages, function implementation is simple: directly call the function name and provide parameters.

In programs, the vast majority of functions need to be written by ourselves. However, in daily work, some functions implemented by functions are very basic and the requirements for results are consistent, these functions are written in advance and can be called directly. We call them "built-in functions ".

For example, the type () function is a built-in function that returns the type of a parameter. When we execute type (23), we will get the result: <type 'int'>, the function reads the 23 type, which is an integer (INT ).

Similarly, we can use built-in functions to convert a string into a number and convert a decimal point into an integer, such:

1 print int(‘32‘)2 print int(3.14)

Of course, not all data can be converted. Just like the following statement, a string cannot be converted into an integer.

1 print int(‘hello‘)

Some may ask, in Python, How do I know which functions I want to use with so many built-in functions? What issues need attention?

The answer is: do not remember. Python has hundreds of built-in functions, which cannot be remembered. It is better to implement it on your own. However, there are some basic and common built-in functions that we can remember after several times, and there is no need to specifically remember them.

Of course, not all data can be converted. Just like the following statement, a string cannot be converted into an integer.

1 print int(‘hello‘)

Some may ask, in Python, How do I know which functions I want to use with so many built-in functions? What issues need attention?

The answer is: do not remember. Python has hundreds of built-in functions, which cannot be remembered. It is better to implement it on your own. However, there are some basic and common built-in functions that we can remember after several times, and there is no need to specifically remember them.

Function call & built-in functions

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.