假设在游戏中刚射杀了一个外星人,请创建一个名为AlienColor(或者alien_color)的变量,并赋值为'green', 'yellow', 或'red'。
编写一条if语句,判断外星人是否是绿色的,如果是,则打印消息,玩家获得了5分。
AlienColor='green'
if AlienColor=='green':print('You get five scores!')
像练习1一样设置外星人的颜色,并编写一个if-else的结构。
·如果外星人是绿色的,则输出一条消息,指出玩家因射杀该外星人获得5分。
·如果外星人不是绿色,则输出该玩家获得10分。
AlienColor='green'
if AlienColor=='green':print('You get five scores!')
else:print('You get ten scores!')
将练习2的结构改为if-elif-else结构
·如果外星人是绿色ÿ