• + 0 comments

    For Python3 Platform

    I wrote the code from scratch just to get more practice

    def connectingTowns(n, routes):
        total= 1
        
        for route in routes:
            total *= route
        
        return total % 1234567
    
    t = int(input())
    for _ in range(t):
        n = int(input().strip())
        routes = list(map(int, input().split()))
        
        result = connectingTowns(n, routes)
        
        print(result)