Question
If you want to add a third option too if and else, you can use
1. Print
2. Input
3. Alter
4. Elif
1. Print
2. Input
3. Alter
4. Elif
Answers
GPT 3.5
Actually, the correct syntax for adding a third option in an if-else statement is by using the keyword "elif". Here's an example:
```python
if condition1:
# execute code if condition1 is True
print("Option 1")
elif condition2:
# execute code if condition1 is False and condition2 is True
print("Option 2")
else:
# execute code if both condition1 and condition2 are False
print("Option 3")
```
In this case, "elif" stands for "else if" and allows you to specify a new condition to check if the preceding "if" statement is not True.
```python
if condition1:
# execute code if condition1 is True
print("Option 1")
elif condition2:
# execute code if condition1 is False and condition2 is True
print("Option 2")
else:
# execute code if both condition1 and condition2 are False
print("Option 3")
```
In this case, "elif" stands for "else if" and allows you to specify a new condition to check if the preceding "if" statement is not True.