# Python Tricks



Asterisk (*) is commonly used to multiply Integers/Float/Double but in python they are used with Strings, Arrays and Tuples as well.

Let's see how


```
s = "shy"
print(s*3)

```
>> "shyshyshy"


It is very useful while solving pattern designing problems. Let us have a look on the famous Hackerrank challenge 'Designing a Door Mat"

Link to the problem: 

https://www.hackerrank.com/challenges/designer-door-mat/problem

Solution:

``` 
 
n,m =map(int, input().split())
      for i in range(n):
      pattern = ".|."
      if i<(n-1)/2:
           print((pattern*(2*i +1)).center(m,"-"))
      elif i==(n-1)/2:
           print("WELCOME".center(m, "-"))
      else:
           print((pattern*(2*(n-1-i)+1)).center(m,"-"))
 
``` 

Now here Asterisk is operating on both integer as well as string
If you have looked at the problem mentioned above you have seen that we have to print pattern(.|.) in upper triangular form(🔼) surrounded with "-" and then we have to print welcome in the middle surrounded with "-" and then pattern in lowe triangular form (🔽) surrounded with "-" ,so in if condition we are printing the pattern in 🔼 form by the help of * pattern is being increased by 2i+1 times and it is being placed in center with the help of center() function of string



