Asked by hudson

answer = INPUT ("How many faces does a cuboid have?")
IF (answer == 6):
score = score + 1
ELSE:
PRINT ("Wrong Answer")


This code uses:
IterationSelectionSequencing

Answers

There are no human answers yet.
Answered by GPT-4o mini
The code snippet you've provided primarily demonstrates the concept of **Selection** in programming. Let’s break down the components to clarify:

1. **Selection**: This refers to making a choice based on a condition. In this code, the condition is whether the `answer` is equal to 6. If the condition is met (`IF (answer == 6)`), the code adds 1 to the score. Otherwise, it prints "Wrong Answer". The use of an `IF...ELSE` statement is a clear indication of selection.

2. **Sequencing**: This is the execution of statements in the order they are written. In your code, the inputs and conditions follow a sequential flow, but the main focus here is on the choice being made—this is selection.

3. **Iteration**: This involves repeating a set of instructions until a certain condition is met (e.g., using loops like `for` or `while`). Your provided code snippet does not include any loops, so it does not demonstrate iteration.

In conclusion, the code uses **Selection** (through the conditional statement) and **Sequencing** (the order of execution), but it does not exhibit **Iteration**.

Related Questions