### Python Features every new programmer must know

Python is one of the best programming language in the world. It is quite easy to learn when compared to other programming languages and it is free. So if you are starting your journey through programming and if its python then you should know these features to gain hands on knowledge of python. Python features every new programmer must know

## Python with Mathematical operator

In :
```string_1="Welcome To Python..."
print(string_1 * 2)
```
```Welcome To Python...Welcome To Python...
```
In :
```print(string_1 + "program..." * 2)
```
```Welcome To Python...program...program...
```

## Reversing the String

In :
```print(string_1[::-1])
```
```...nohtyP oT emocleW
```

## Printing the selected part of the string

In :
```print(string_1[0:7])
```
```Welcome
```
In :
```list_1=[11,12,13,14,15]
print(list_1[::-1])
```
```[15, 14, 13, 12, 11]
```

## Joining of Strings and Reversing

In :
```list_2=["Hello", "Frank", "is", "Here", "Everyone"]
print(" ".join(list_2[::-1]) + " "",Right!!!")
```
```Everyone Here is Frank Hello ,Right!!!
```

## List Comprehension

In :
```def mult(x):
return x**2+10
x=5
mult(x)
```
Out:
`35`

## Lets separate out the even numbers from the list_num to a new list list_even

In :
```list_num=[11,12,13,14,15,16]
list_even=[]
for x in list_num:
if x % 2 ==0:
list_even.append(x)
print(list_even)
```
```[12, 14, 16]
```

## After separating the even numbers lets use the function to see what results we get

In :
```list_num=[11,12,13,14,15,16]
list_even=[]
for x in list_num:
if x % 2 ==0:
list_even.append(mult(x))
print(list_even)
```
```[154, 206, 266]
```

## Instead of writing the code in such a long manner, we can do it in one line

In :
```list_num=[11,12,13,14,15,16]
print([mult(x) for x in list_num if x % 2 == 0])
```
```[154, 206, 266]
```

## What if we don't want to use the function

In :
```print([x ** 2 +10 for x in list_num if x % 2 == 0])
```
```[154, 206, 266]
```

## Now lets see what is lambda how to use it

In :
```mult = lambda x : x ** 2 +10
print([mult(12), mult(14), mult(16)])
```
```[154, 206, 266]
```
In :
```list_int=[2, 1, 0, -1, -2]
print(sorted(list_int))
```
```[-2, -1, 0, 1, 2]
```

## Lets use lambda for modification

In :
```print(sorted(list_int, key = lambda x : x ** 2))
```
```[0, 1, -1, 2, -2]
```

## Now lets see what is Map how to use it

### map(function, sequence)

In :
```print(list(map(lambda x,y,z : x+y+z, [2,4,6],[1,3,5],[1,1,1])))
```
```[4, 8, 12]
```

## Lets see this in a simple way

In :
```x, y, z =  [2,4,6], [1,3,5], [1,1,1]
Total=[]
for i in range(len(x)):
Total.append(x[i]+y[i]+z[i])
print(Total)
```
```[4, 8, 12]
```

## if, elif and else condition in one line

In :
```x=int(input())
if x >= 18:
elif x < 18:
print("Teenager")
else:
print("Not Matched")
```
```Adult
```

## Now lets code it in one line

In :
```x=int(input())
print("Adult" if x >= 18 else "Teenager" if x < 18 else "Not Matched")
```
```Teenager
```

## How to use Zip()

In :
```Country = ["India", "Bangladesh", "Sri Lanka"]
Capital = ["Mumbai", "Dhaka", "Colombo"]
print([" ".join(x) for x in zip(Country, Capital)])
```
`['India Mumbai', 'Bangladesh Dhaka', 'Sri Lanka Colombo']`
`Thank you for reading.`