if/elif statements

I think part of your confusion about why 'elif’s are useful when more 'if’s seem to do the same thing is that in your examples, it is true that if one of your ‘if’ conditions is true, then all of the rest will be false (e.g., this happens all of the conditions are testing equality of the same thing against different constants). When that is true, indeed the only usual reason to use ‘elif’ instead of ‘if’ is efficiency - avoiding all of those subsequent tests.

However, ‘if’ conditions needn’t be mutually exclusive that way, and sometimes you use ‘elif’ with a condition that maybe isn’t as full as it would need to be when expressed as an ‘if’ condition, because the ‘elif’ can assume that all previous tests have been tried and failed.

As a contrived example, suppose you wanted to do one thing if a string starts with “as” and another if it starts with “asterisk”, and you want to do only one of these, preferring the longer match if it exists. You could do:

if s.startswith("asterisk"):
  # do the thing for "asterisk"
elif s.startswith("as"):
  # do the thing for "as"

Note that if you use ‘if’ instead of ‘elif’ for the second condition, it would not work as intended - both operations would happen instead of just one. To do the same thing with only ‘if’ statements you would have to do this:

if s.startswith("asterisk"):
  # do the thing for "asterisk"
if s.startswith("as") and not s.startswith("asterisk"):
  # do the thing for "as"