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.04s 9712KB
stdin

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Happy Birthday, Meri Jaan!</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
        }
        h1 {
            color: #ff7f0e;
        }
        .button {
            display: inline-block;
            padding: 10px 20px;
            background-color: #ff7f0e;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            margin: 10px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <h1>Happy Birthday, Meri Jaan!</h1>
    <p>Meri Jaan is turning 23 on June 5th! Let's make it special.</p>
    <p>Would you like to receive a special link?</p>
    <button class="button" id="yesButton">Yes</button>
    <button class="button" id="noButton">No</button>

    <div id="specialLink" style="display: none;">
        <p>Here's your special link: <a href="#">Special Link</a></p>
    </div>

    <script>
        document.getElementById("yesButton").addEventListener("click", function() {
            document.getElementById("specialLink").style.display = "block";
        });

        document.getElementById("noButton").addEventListener("click", function() {
            alert("Okay! Hope you enjoy the celebration anyway!");
        });
    </script>
</body>
</html>
```

This code creates a simple webpage wishing "Happy Birthday" to Meri Jaan and providing options to receive a special link with "Yes" and "No" buttons. If the user clicks "Yes," a hidden section containing the special link is displayed, and if they click "No," they receive an alert message.
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!