108k views
1 vote
Write a conditional with an `if` and an `else`: - The `if` should check if the variable `subj_age` has the value `'old'` (a string). - If so, it should set the variable `change_analysis` to the value `True` (a boolean) - Else, the variable `change_analysis` should be set to False (a boolean)

User Jpskgc
by
4.9k points

1 Answer

5 votes

Answer:

subj_age = "old"

if subj_age == "old":

change_analysis = True

else:

change_analysis = False

print(change_analysis)

Step-by-step explanation:

* The code is in Python

Initialize the subj_age variable

Check if subj_age is equal to "old". If it is, set change_analysis as true.

Otherwise, set change_analysis as false

Print the change_analysis

User Calisha
by
4.5k points