fork download
  1. # Design a program that prompts the user to enter the names of two primary colors to mix. If
  2. # the user enters anything other than red, blue or yellow, the program should display an error
  3. # message. Otherwise the program should display the name of the secondary color that results.
  4.  
  5. print('You will be mixing two primary colors to get a resulting color.')
  6. print('Primary colors are blue, red and yellow \n')
  7.  
  8. red = 1
  9. blue = 2
  10. yellow = 3
  11.  
  12. color1 = input('Enter your first primary color: \n')
  13. color2 = input('Enter your second primary color: \n')
  14.  
  15. if color1 == 1 and color2 == 2:
  16. print('That makes purple!')
  17.  
  18. elif color1 == 2 and color2 == 1:
  19. print('That makes purple!')
  20.  
  21. elif color1 == 3 and color2 == 1:
  22. print('That makes orange!')
  23.  
  24. elif color1 == 1 and color2 == 3:
  25. print('That makes orange!')
  26.  
  27. elif color1 == 2 and color2 == 3:
  28. print('That makes green!')
  29.  
  30. elif color1 == 3 and color2 == 2:
  31. print('That makes green!')
  32.  
  33. else:
  34. print('You did not enter a primary color!')
  35.  
  36.  
  37.  
Success #stdin #stdout 0.03s 9656KB
stdin
1
5
<!DOCTYPE html>
<html lang="ar">
<head>
  <title>نموذج قابل للوصول</title>
</head>
<body>
  <form>
    <label for="name">الاسم:</label>
    <input type="text" id="name" aria-label="حقل إدخال الاسم">
    
    <label for="email">البريد الإلكتروني:</label>
    <input type="email" id="email" aria-label="حقل إدخال البريد الإلكتروني">
    
    <button type="submit" aria-label="زر الإرسال">إرسال</button>
  </form>
</body>
</html>
stdout
You will be mixing two primary colors to get a resulting color.
Primary colors are blue, red and yellow 

Enter your first primary color: 
Enter your second primary color: 
You did not enter a primary color!