Question: ```
import smtplib
from email.message import EmailMessage

list1=[
    'Person 1 <email1@outlook.com>',
    'Person 2 <email2@gmail.com>'
    ]

list2=[
    'Person 3 <email3@yahoo.com>',
    'Person 4 <email4@hotmail.com>'
    ]

masterlist = [list1, list2]

for x in masterlist:
    receivers = ", ".join(x)

msg = EmailMessage()
msg['Subject'] = 'This is a Test Email'
msg['From'] = 'Person 5 <email5@outlook.com>'
msg['To'] = receivers
msg.set_content('Ignore this message')

with smtplib.SMTP('smtp.outlook.com', 587) as smtp:
    smtp.send_message(msg)

```

This is the code that I have used.I would like to send this email out to certain groups, but *not* join all emails into one email. The way I have it now, only ends up sending the email out to the last list of emails. How should I modify this to be able to send it to multiple lists of emails?

Answer: 
Since your values are in a continuous range, this can be simplified as:

```
assign F = ((BCD >= 4'd1) && (BCD <= 4'd5));

```

If your tool set supports SystemVerilog syntax, you could also use the `inside` operator. Refer to IEEE Std 1800-2017, section 11.4.13 *Set membership operator*.
There are several ways to do this:

a) Boundary check.

```
assign F = (BCD > 4'd0) & (BCD < 4'd6);

```

b) OR reduction and a high limit check.

```
assign F = |BCD & (BCD < 4'd6);

```

c) This is a behavioural hardware description, it would be optimized by the synthesis tool. It is parameterized, though.

```
localparam LOW = 1;
localparam HIGH = 5;
integer i;
reg F;
always @ (*) begin
  F = 1'b0;
  for(i = LOW; i <= HIGH; i = i + 1) begin: val_check
    if(BCD == i[3:0]) F = 1'b1;
  end
end

```