Question about loops
This question is about loops. You need to write a loop which repeats a certain number of times, print a few strings and print one string at a specific point in the loop.
-
Begin by specifying a loop. This may be a
whileloop or aforloop, but you are only allowed to use one loop to answer this question. The loop must repeat 7 times. -
For each step in the loop, print the string
"I made a fried egg". -
After the string
"I made a fried egg"has been printed 3 times, print the string"I also made baked beans". Then continue iterating to the end of the loop. -
Once the loop has finished, print the string
"This breakfast is too large"
The expected output is:
I made a fried egg
I made a fried egg
I made a fried egg
I also made baked beans
I made a fried egg
I made a fried egg
I made a fried egg
I made a fried egg
This breakfast is too large
(This would be a relatively easy question, by the way).