วันเสาร์ที่ 24 ตุลาคม พ.ศ. 2558

lab 6 student data Average age and minimum weight

def setup():
    name = ["Keane","Giggs","Cole","Scholes","Park","Nani"]
    student_number = [1,2,3,4,5,6]
    age = [35,19,18,20,19,31]
    high = [177,182,170,169,185,160]
    weight = [95,50,90,75,60,48]
    data = [student_number,age,high,weight,name]
    print('Student name     ',data[4][0])
    print('Student number ',data[0][0])
    print('Age            ',data[1][0],'years old')
    print('High           ',data[2][0],'cm.')
    print('Weight         ',data[3][0],'kg.')
    print('Student name     ',data[4][1])
    print('Student number ',data[0][1])
    print('Age            ',data[1][1],'years old')
    print('High           ',data[2][1],'cm.')
    print('Weight         ',data[3][1],'kg.')
    print('Student name     ',data[4][2])
    print('Student number ',data[0][2])
    print('Age            ',data[1][2],'years old')
    print('High           ',data[2][2],'cm.')
    print('Weight         ',data[3][2],'kg.')
    print('Student name     ',data[4][3])
    print('Student number ',data[0][3])
    print('Age            ',data[1][3],'years old')
    print('High           ',data[2][3],'cm.')
    print('Weight         ',data[3][3],'kg.')
    print('Student name     ',data[4][4])
    print('Student number ',data[0][4])
    print('Age            ',data[1][4],'years old')
    print('High           ',data[2][4],'cm.')
    print('Weight         ',data[3][4],'kg.')
    print('Student name     ',data[4][5])
    print('Student number ',data[0][5])
    print('Age            ',data[1][5],'years old')
    print('High           ',data[2][5],'cm.')
    print('Weight         ',data[3][5],'kg.')
    print('Average age',(age[0]+age[1]+age[2]+age[3]+age[4]+age[5])/4,'Years old')
    print('The minimum weight is',find_minimum_weight(weight),'kg.')
def find_minimum_weight(weight):
    count = 0
    minimum = 100
    while(count < len(weight)):
        if(weight[count] < minimum):
            minimum = weight[count]
        count = count + 1
    return minimum

setup()  


ไม่มีความคิดเห็น:

แสดงความคิดเห็น