FRQ 4 (Collegeboard)

Only the collegeboard portions here, rest found on review ticket

import java.util.Random;

public class LightBoard{
    /** The lights on the board, where true represents on and false represents off.
    */ 
    private boolean[][] lights;

    public LightBoard(int numRows, int numCols){
    /** Constructs a LightBoard object having numRows rows and numCols columns.
     * Precondition: numRows > 0, numCols > 0
     * Postcondition: each light has a 40% probability of being set to on.
     */ 
        lights = new boolean[numRows][numCols];

        for(int row = 0; row < numRows; row++){
            for(int col = 0; col < numCols; col++){
                if(Math.random() < 0.4){
                    lights[row][col] = new Light();  
                }
            }
        }
    
    }

    /** Evaluates a light in row index row and column index col and returns a status
     * as described in part (b).
     * Precondition: row and col are valid indexes in lights.
     */
    public boolean evaluateLight(int row, int col){
        if (lights[row][col] == true) {
            int count = 0;

            for (int r = 0; r < lights.length; r++){
               if (lights[r][col] == true){
                   count++;
               }
            }
            if (count % 2  == 1){
               return true;
            }
            else{
               return false;
            }

        } 
        else if (lights[row][col] == false) {
            int count = 0;
            
            for (int r = 0; r < lights.length; r++){
                if (lights[r][col] == true){
                    count++;
                }
            }
            if (count % 3 == 0) {
                return true;
            }
            else {
                return false;
            }
        }
    }
}
def f(a, b, *c, d):
    return a + b + len(c) + d

f(1, 2, 3, 4, d=5)
10