Constraints to generate random password in SV

In reply to Alokpati:
thank you for your answer :)

could you please tell me why we are doing pw.sum here to get each value? I’m just trying to understand how you reached to this answer.

I read in LRM that “sum() returns the sum of all the array elements or, if a with clause is specified, returns the sum of the values yielded by evaluating the expression for each array element.”

    pw.sum() with (**7'**(item inside {[97:122]}))==1; //a-z
     - why are we doing 7' here?
            
    pw.sum() with (7'(item inside {[48:57]}))==7; 
     - this means that 7 numbers between [48-57] are randomly chosen. Say 40-46 are chosen, does it mean that all these 7 numbers are returned to the sum function?