Friday, February 1, 2019

Range Function

  • Problem Description

    Write a program to find the range of squares using List

    Input:
    1. The Lower range
    2 The upper range

    Output:
    The square of upper and lower number using list
  • CODING ARENA
  • a=int(input())
    b=int(input())
    x=[]
    for i in range(a,b+1):
        x.append((i,i*i))
    print(x)
  • Test Case 1

    Input (stdin)
    2
    
    5
    
    
    Expected Output
    [(2, 4), (3, 9), (4, 16), (5, 25)]
  • Test Case 2

    Input (stdin)
    5
    
    10
    
    
    Expected Output
    [(5, 25), (6, 36), (7, 49), (8, 64), (9, 81), (10, 100)]

No comments:

Post a Comment