Friday, February 1, 2019

Display Items

  • Problem Description

    Write a program to get four dictionary items and display all the key-values format using update function and items() function
  • CODING ARENA
  • a=int(input())
    b=int(input())
    c=int(input())
    d=int(input())
    e=int(input())
    f=int(input())
    g=int(input())
    h=int(input())
    d1={}
    d2={}
    d3={}
    d4={}
    d1.update({a:b})
    d2.update({c:d})
    d3.update({e:f})
    d4.update({g:h})
    print("%s"% list(d1.items()))
    print("%s"% list(d2.items()))
    print("%s"% list(d3.items()))
    print("%s"% list(d4.items()))
  • Test Case 1

    Input (stdin)
    10
    
    -10
    
    20
    
    -20
    
    30
    
    -30
    
    40
    
    -40
    
    
    Expected Output
    [(10, -10)]
    
    [(20, -20)]
    
    [(30, -30)]
    
    [(40, -40)]
  • Test Case 2

    Input (stdin)
    20
    
    200
    
    10
    
    100
    
    30
    
    300
    
    40
    
    400
    
    
    Expected Output
    [(20, 200)]
    
    [(10, 100)]
    
    [(30, 300)]
    
    [(40, 400)]

No comments:

Post a Comment