I am not able to understand why is line 22 an operator error
My Code:
#let's produce 30 aliens
aliens=[]
for alien_number in range(30) :
new_alien = {'colour':'green','points':5}
aliens.append(new_alien)
#changing asome aliens to another type
for alien_x in aliens[:3] :
alien_x['colour'] = 'yellow'
alien_x['points'] = 10
print(aliens[:5])
print(f"no, of aliens is {len(aliens)}")
# game speeds up/ level up
for alien_x in aliens :
if alien_x['colour'] == 'yellow' :
alien_x['colour'] = 'red' and alien_x['points'] = alien_x['points'] + 10
elif alien_x['colour'] == 'green' :
alien_x['colour'] = 'yellow' and alien_x['points'] = alien_x['points'] + 10
print(aliens)
error:
alien_x['colour'] = 'yellow' and alien_x['points'] = alien_x['points'] + 10
^
SyntaxError: cannot assign to operator
intended purpose:
first set generates a nested list of 30 dictonaries
then we change first three aliens to yellow
we print the first 5 aliens
now change all yellow aliens to red and green aliens to yellow
print all aliens