# Overwriting or updating string inside a list

I was given a simple task of writing a code to uppercase the odd indexed charachters of a string inside a list , to which i coded as follows :

```list1 = []
x = int(input("Enter the size of list : "))
for i in range(x):
temp = str(input("Enter the element you wish to insert : "))
list1.append(temp)
for i in range(x):
size = len(list1[i])
for j in range(size):
if j%2 == 0:
list1[i][j].replace(list1[i][j],list1[i][j].upper())
print(list1)
```

but it doesn’t seems to be working and on printing the list1 it simply returns the normal string inside list . Help a beginner out

You don’t actually need the inner for loop. You can just check if `i` divided by 2 is equal to 1 and replace it.

```list1 = []
x = int(input("Enter the size of list : "))
for i in range(x):
temp = str(input("Enter the element you wish to insert : "))
list1.append(temp)
for i in range(x):
if i%2==1:
list1[i]=list1[i].upper()

print(list1)
```

Example:

```Enter the size of list : 4
Enter the element you wish to insert : a
Enter the element you wish to insert : b
Enter the element you wish to insert : c
Enter the element you wish to insert : d
['a', 'B', 'c', 'D']
```

If you want to change case of individual characters of elements, you can do the following:

```list1 = []
x = int(input("Enter the size of list : "))
for i in range(x):
temp = str(input("Enter the element you wish to insert : "))
list1.append(temp)

for i in range(x):
list1[i]=''.join(i.upper() if j%2==0 else i for j,i in enumerate(list1[i]))
print(list1)
```

Output:

```Enter the size of list : 3
Enter the element you wish to insert : cat
Enter the element you wish to insert : hen
Enter the element you wish to insert : pig
['CaT', 'HeN', 'PiG']
```