DEV Community

Sarah Dye
Sarah Dye

Posted on • Updated on

How to Translate Some Text into Pseudocode

Let’s write some pseudocode! The first challenge in this lesson is a guided exercise. Students are given a scenario to translate into some pseudocode.

However, Skillcrush has already done most of the work by writing most of the instructions. Students just fill in the blanks with the right keywords. Here’s our scenario below.

Tonight Jill is going to make her famous stir fry – which is so delicious because she’s very particular about the order in which she cooks her ingredients, which she chops before she starts cooking. Once she’s done, here’s what she does:

  • She adds sesame oil and coconut oil to the pan and gets it nice and hot
  • Then she adds carrots and onions, which she simmers until they’re both nice and soft
  • Then she adds her chicken, along with just a little bit of soy sauce
  • Then she adds her zucchini
  • Then sugar snap peas
  • Then right at the end, she adds a dash of mirin and a bit of chili oil

Then her stir fry is done! She dishes some completed stir fry onto her plate, adds a bit of sriracha, soy sauce, and sesame seeds, and eats up her perfect stir fry!


Let’s take this one step at a time. First, let’s make a statement to input the sesame oil and coconut oil. We want to use input here since that is similar to adding something to a website.

You will be using input for the next five steps for the other ingredients. Don’t worry about adding details about the temperature or texture. We just want to get the important information into the pseudocode.

Time for the final touches!

For step six, we will output the stir fry. Output the stir fry is where we will have a completed stir fry. Next, you will want to store everything in a variable so we will add the store keyword for stir fry.

Now that the stir fry is stored in a variable, you just need to add the garnishes. We will do this by adding the input keyword for the remaining ingredients. The last thing you need to do in this exercise is output the stir fry with the garnishes. You will do this by adding one last output with stir fry.

Finished Pseudocode

Here’s the finished pseudocode. Pseudocode will vary for each developer on this exercise. The goal here isn’t to get too bogged down in the details. Instead, you want to get text written in a way the computer would be able to understand.

INPUT sesame oil and coconut oil
INPUT carrots and onions
INPUT chicken and a little bit of soy sauce
INPUT zucchini
INPUT sugar snap peas
INPUT dash of mirin and a bit of chili oil
OUTPUT stir fry
STORE stir fry
INPUT sriracha, soy sauce, and sesame seeds
OUTPUT stir fry
Enter fullscreen mode Exit fullscreen mode

Top comments (0)