Renk karışımı kodlaması

BerkayB.2000

Centipat
Katılım
11 Ağustos 2020
Mesajlar
43
Python:
first=input("Enter primary color:")
second=input("Enter primary color:")
if first=="red" and second=="blue" or first=="blue" and second=="red":
    print("When you mix {} and {}, you get purple.".format(first,second))
elif first=="red" and second==" yellow" or first=="yellow" and second=="red":
    print("When you mix {} and {}, you get orange.".format(first,second))
elif first==" blue" and second=="yellow" or first=="yellow" and second=="blue":
    print("When you mix {} and {}, you get green.".format(first,second))
else:
    print("You didn't input two primary colors.")

Bu kodlamada ilk renk için blue, ikinci renk olarak yellow input olarak girildiğinde "You didn't input two primary colors" ifadesine yönlendiriyor. Nasıl düzeltebilirim?
 
Son düzenleyen: Moderatör:
Python:
first=input("Enter primary color:")
second=input("Enter primary color:")
if first=="red" and second=="blue" or first=="blue" and second=="red":
    print("When you mix {} and {}, you get purple.".format(first,second))
elif first=="red" and second==" yellow" or first=="yellow" and second=="red":
    print("When you mix {} and {}, you get orange.".format(first,second))
elif first==" blue" and second=="yellow" or first=="yellow" and second=="blue":
    print("When you mix {} and {}, you get green.".format(first,second))
else:
    print("You didn't input two primary colors.")

Bu kodlamada ilk renk için blue, ikinci renk olarak yellow input olarak girildiğinde "You didn't input two primary colors" ifadesine yönlendiriyor. Nasıl düzeltebilirim?
Düzenleme: " blue" burada fazladan boşluk var, ondan dolayı olmuş.
 
Son düzenleme:
Uyarı! Bu konu 6 yıl önce açıldı.
Muhtemelen daha fazla tartışma gerekli değildir ki bu durumda yeni bir konu başlatmayı öneririz. Eğer yine de cevabınızın gerekli olduğunu düşünüyorsanız buna rağmen cevap verebilirsiniz.

Bu konuyu görüntüleyen kullanıcılar

Technopat Haberler

Geri
Yukarı