Q. Write a program to find the range, from a given list, e.g., if the given list is:
23,9,14,2,28, 19, 3,15,9,25,2, 4, 9
Then your code should print 26.
Hint. Range is the difference between the largest and lowest number. In this case 2 is largest is 28 and lowest is 2. So 28 - 2 is 26.
Answer =
lst = eval(input ("Enter the List :- ")) lst.sort() print ("Range is :- ", lst[ len(lst) - 1] - lst[ 0 ])
add in 2nd line:-
ReplyDeletelst=list(lst)
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )