Write a program which allows the user to input a list of fiv
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/11 15:10:16
Write a program which allows the user to input a list of five numbers.
Write a program which allows the user to input a list of five numbers,then tells them the smallest,largest and median of the numbers they have entered.Hint:use the .sort() method of the list.
Write a program which allows the user to input a list of five numbers,then tells them the smallest,largest and median of the numbers they have entered.Hint:use the .sort() method of the list.
def largest(data):
return data[len(data)-1]
def smallest(data):
return data[0]
def median(data):
return sum(data)*1.0/len(data)
def calc(data):
data.sort()
print 'Largest: ' + str(largest(data))
print 'Smallest: ' + str(smallest(data))
print 'Median: ' + str(median(data))
if __name__ == '__main__':
data = [10,9,6,10,5,-1,7,18,9,7,2,3,0,10,23]
calc(data)
return data[len(data)-1]
def smallest(data):
return data[0]
def median(data):
return sum(data)*1.0/len(data)
def calc(data):
data.sort()
print 'Largest: ' + str(largest(data))
print 'Smallest: ' + str(smallest(data))
print 'Median: ' + str(median(data))
if __name__ == '__main__':
data = [10,9,6,10,5,-1,7,18,9,7,2,3,0,10,23]
calc(data)
Write a program which allows the user to input a list of fiv
Write a program which allows the user to enter a list of num
Write a program which asks the user for four numbers and the
Write a program which asks the user for four numbers(Python)
英语翻译to have the demo program simulate a sensor input
英语翻译write a program to allow a user to do conversions betwee
1. Write a program to copy its input to its output, replacin
Write a program,which performs as the following:(java)
Java write a program to calculate the sum of each of the ser
Java write a program to calculate the factorial of any natur
Write a program to append one file”1.txt” at the end of anot
a list of things which have to be done.P____