Python operator * * (two multiplication sign is a exponentiation)

Source: Internet
Author: User

A multiplication sign *, if the operand is two digits, which is the two numbers multiplied, such as 2*4, the result is 8
* * Two multiplication sign is the exponentiation. Like 3**4, the result is 3 of 4, and the result is 81.

* If a string, list, tuple is multiplied by an integer n, returns a homogeneous object with all its elements repeating n times, such as "str" to return the string "Strstrstr"

If the * in front of the parameter in the function definition is represented by placing multiple parameters on the call into a tuple, * * means that the keyword argument when the function is called is placed in a dictionary
Args= (a)
Func= (*args)
Equivalent to function call Func (+/-)

Print (3**4)  # The result is Bayi  = input ('input a string')print(' with str*3 Output three times str:'#* If it is a string, a list, a tuple multiplied by an integer n, returns a homogeneous object with all its elements repeating n times

Python operator * * (two multiplication sign is a exponentiation)

Related Article

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.