Friday, February 1, 2019

Print the dictionary

  • Problem Description

    Write a program to get the input of key and value of the element in dictionary.

    Display the key-value pair in the python dictionary format.

    Refer sample input and output for formatting specification. 

    All float values are displayed correct to 2 decimal places. 

    All text in bold corresponds to input and the rest corresponds to output.
  • CODING ARENA
  • d1={}
    d2={}
    a=int(input())
    b=int(input())
    d1.update({a:b})
    print("Updated dictionary is:")
    print(d1)
          
  • Test Case 1

    Input (stdin)
    25
    
    75
    
    
    Expected Output
    Updated dictionary is:
    
    {25: 75}
  • Test Case 2

    Input (stdin)
    2017
    
    2019
    
    
    Expected Output
    Updated dictionary is:
    
    {2017: 2019}

No comments:

Post a Comment