Pick the one that's best for showing a user unsubscribed from a service.
1. subscribed = True
2. subscribe = False
(2)
Using subscribed = False clearly indicates that the user is not subscribed, which is straightforward and easy to understand. This approach uses a boolean value, making the code more readable and maintainable.
We can use bool() to convert a variable into a Boolean. If the variable has content, it will become True. If it's empty or 0, it'll become False.
member = "Sam"
middle_name = ""
foot_size = 8.5
siblings = 0
boolean_member =
bool(member)
boolean_middle_name =
bool(middle_name)
boolean_foot_size =
bool(foot_size)
boolean_siblings =
bool(siblings)
print(boolean_member)
print(boolean_middle_name)
print(boolean_foot_size)
print(boolean_siblings)
True
False
True
False


