## delete element in list python

### Description

```Python Program to get an element and delete the element from list.
Input:
5
5 7 9 3 1
9
Output:
5 7 3 1```

### Solution

```l=list(map(int,input("Enter Numbers:").split()))
e=int(input("Enter the element to delete"))
for i in range(0,len(l)):
if(l[i]==e):
for j in range(i,len(l)-1):
l[j]=l[j+1]
l[j+1]=None
print(l)

```

### Explanation

```visit every location in the list

if current element in list l[i] is equal to the element which is to be deleted. Then move all the elements located after i to its previous position using:
l[i] = l[i+1]

```

#### Author - Ramesh P Natarajan

Learner, Professor, Technology Trainer, Software Developer and Content Marketer, very much passionate in the field of Software Application Development, Machine Learning and Search Engine Optimization.

Write to: admin@decodeschool.com

### Interesting Pattern Programs: for more Patterns

```Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution```
```Input:
5
Output:
*
***
*****
*******
*********
*******
*****
***
*Solution```
```Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution```
```Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution```
```Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution```
```Input:
5
Output:
*********
*******
*****
***
*
***
*****
*******
*********Solution```