0
flag=False
if color1=="blue":
color2=input("Do you want to mix red or yellow with blue?")
color2=color2.lower()
while flag==False:
if color2=="red" or color2=="yellow":
flag = True
else:
color2=input("That is not a valid choice. Enter either red or yellow to mix\ with", color1)
if color2=="red":
print("The color you made is purple")
else:
print("The color you made is green")
flag=False
elif color1=="red":
color2=input("Do you want to mix blue or yellow with red?")
color2=color2.lower()
while flag==False:
if color2=="blue" or color2=="yellow":
flag = True
else:
color2=input("That is not a valid choice. Enter either blue or yellow to\ mix with", color1)
我遇到了一個問題,其中有一條elif語句朝着中間一行說「elif color1 ==」紅色「:」。爲了得到一些背景知識,這是一個簡單的程序,它將混合三種原色。Python說elif語句的語法錯誤
謝謝youuuu!我從來不知道這個!你不知道我有多寬慰。我花了將近30分鐘試圖解決這個問題。^- ^ –