First time writing Pseudocode, can someone help me?

63 views Asked by At

My assignment is to write Pseudocode for a program I was told to create. The Color Mixer program in Python. Here are two examples of how to write the Psuedocode out of the book I was told to read.

Declare Integer age

Display "What is your age?"

Input age

Display "Here is the value that you entered:"

Display age

If temperature < 40 Then
   Display "A little cold, isn't it?"
Else
   Display "Nice weather we're having."
End If

By that logic, I came up with this Psuedocode for the color mixer program I wrote.

Declare String color1, color2, color3

Display "Enter Primary Color"
input color1

Display "Enter Secondary Color"
input color2

If color1 == "blue" and color2 == "red" or color1 == "red" and color2 == "blue" Then
    Display "When you mix Red and Blue, you get Purple."

Else If color1 == "yellow" and color2 == "blue" or color1 == "blue" and color2 == "yellow" Then
    Display "When you mix Yellow and Blue, you get Green."

Else If color1 == "red" and color2 == "yellow" or color1 == "yellow" and color2 == "red" Then
    Display "When you mix Red and Yellow, you get Orange."

Else
    Display "Enter a correct color"
End If

Would this be the correct way to write the Pseudocode?

0

There are 0 answers