Friday, February 1, 2019

X and X*X

  • Problem Description

    Python Program to Generate a Dictionary that Contains Numbers (between 1 and n) in the Form (x,x*x).
  • CODING ARENA
  • n=int(input())
    d={x:x*x for x in range(1,n+1)}
    print(d)
  • Test Case 1

    Input (stdin)
    5
    
    
    Expected Output
    {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
  • Test Case 2

    Input (stdin)
    4
    
    
    Expected Output
    {1: 1, 2: 4, 3: 9, 4: 16}

No comments:

Post a Comment