#To change elements in list base on a specific condition
#Using list comprehension
original_list = [1,20,3,40,5]
new_list = ['Do something' if x > 10 else x for x in original_list]
# [1, 'Do something', 3, 'Do something', 5]
# Replace 'Koweit' To 'Sudan'
my_list = [ "Egypt", "Koweit", "Algeria", "Morocco", "Tunisia" ]
my_list[ 1 ] = "Sudan"
print( my_list )
#Change the values "banana" and "cherry" with the
#values "blackcurrant" and "watermelon":
thislist = ["apple", "banana", "cherry", "orange", "kiwi", "mango"]
thislist[1:3] = ["blackcurrant", "watermelon"]
print(thislist)
#Output :['apple', 'blackcurrant', 'watermelon', 'orange', 'kiwi', 'mango']
a = [1,2,3]
a[2] = "b"
print(a)
# [1, 2, 'b']