Friday, February 1, 2019

Matrix Display -Type 2

  • Problem Description

    Write a python program to create a NESTED LIST and form a matrix. (Without Square Brackets)

    Hint:

    1. Input the number of rows and columns for First Matrix

    2. Input the number of rows and columns for Second Matrix

    3. Display the first matrix elements in Matrix format (Without commas and Square Bracket)

    4. Display the first matrix elements in Matrix format (Without commas and Square Bracket)
  • CODING ARENA
  • a=int(input())
    b=int(input())
    print("Matrix 1")
    for i in range(a):
        for j in range(a):
            x=int(input())
            print(x)
    print("Matrix 2")        
    for i in range(b):
        for j in range(b):
            x=int(input())
            print(x)
  • Test Case 1

    Input (stdin)
    2
    
    2
    
    10
    
    20
    
    30
    
    40
    
    140
    
    130
    
    120
    
    110
    
    
    Expected Output
    Matrix 1
    
    10
    
    20
    
    30
    
    40
    
    Matrix 2
    
    140
    
    130
    
    120
    
    110
  • Test Case 2

    Input (stdin)
    3
    
    3
    
    10
    
    20
    
    30
    
    40
    
    50
    
    60
    
    70
    
    80
    
    90
    
    190
    
    180
    
    170
    
    160
    
    150
    
    140
    
    130
    
    120
    
    110
    
    
    Expected Output
    Matrix 1
    
    10
    
    20
    
    30
    
    40
    
    50
    
    60
    
    70
    
    80
    
    90
    
    Matrix 2
    
    190
    
    180
    
    170
    
    160
    
    150
    
    140
    
    130
    
    120
    
    110

No comments:

Post a Comment