Python operator ** (two multiplication signs are the multiplication party), and python multiplication party

Source: Internet
Author: User

Python operator ** (two multiplication signs are the multiplication party), and python multiplication party

A multiplication Number *. If the operand is two digits, the two digits are multiplied. For example, 2*4, the result is 8.
** Two multiplication signs are the multiplication parties. For example, 3 ** 4, the result is the 4 power of 3, and the result is 81.

* If the string, list, And tuples are multiplied by an integer N, an object of the same type with all its elements repeated N times is returned. For example, "str" * 3, a string "strstrstr" is returned"

If the * Before the parameter in the function definition indicates that multiple parameters are put into the tuples during the call, ** indicates that the keyword parameter used to call the function is put into a dictionary.
Args = (1, 2, 3)
Func = (* args)
It is equivalent to function call func (, 3)

Print (3 ** 4) # The result is 81str = input ('input a string') print ('use str * 3 to output three times str: ', str * 3) # * If the string, list, And tuples are multiplied by an integer N, an object of the same type with all its elements repeated N times is returned.

 

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.