Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 2

print("---Input---")

name = input("Name: ")


sex = input("Sex: ")
age = input("Age(years): ")
weight = int(input("Weight(kg): "))
height = int(input("Height(cms): "))

print("---Workout Input---")
lines = []
while True:
        line = input()
        if line:
                lines.append(line)
        else:
                break
#print(lines)

print("---Output---")
#bmi calculation
bmi = weight / (height/100)**2
print("Your BMI is",round(bmi,2))
if bmi < 18.5:
        print("Try to put on some weight")
elif bmi < 24.9:
        print("You are good")
elif bmi < 29.9:
        print("Try to reduce some weight")
else:
        print("You should try to reduce your weight")

#acheivement calculation
print("Your acheivement is as follows:")
n = len(lines)
if n==7:
        list = []
        count = 0
        for i in lines:
                list = i.split(',')
                if int(list[1]) != 0:
                        count = count + 1
        if count == 7:
                print("No breakouts in session: You get a 7/7 award")
else :
        list = []
        weeknumber = []
        count = 0
        weeklyaward = 0
        monthlyaward = 0
        for i in lines:
                list = i.split(',')
                if int(list[1]) != 0:
                        count = count + 1
                if int(list[0]) == 7:
                        if count == 7:
                                weeklyaward = weeklyaward + 1
                                weeknumber.append(1)
                        else:
                                weeknumber.append(0)
                        count = 0
        for i in range(0,int(n/7),4):
                if weeknumber[i] == 1 and weeknumber[i+1] == 1 and weeknumber[i+2] == 1 and
weeknumber[i+3] == 1:
                        monthlyaward = monthlyaward + 1
        print("You get ",weeklyaward," 7/7 award")
        if n > 7:
                print("You get ",monthlyaward," M/M award")

#speed and distance calculation


list=[]
timearray = []
totaldistancekm = 0
totalspeedkmh = 0
maxdistancekm = 0
mindistancekm = 1080 #Max speed of human 45 Km/hr * 24 hrs = 1080 Kms in a day at max
maxspeedkmh = 0
minspeedkmh = 45 #Max speed of human = 45 Km/hr
for i in lines:
        list = i.split(',')
        if int(list[1]) == 0:
                continue
        distancekm = float(list[1]) * 0.000762 #1 step = 0.000762 km
        timearray = list[2].split(':')
        timehrs = float(timearray[0]) + float(timearray[1])/60 + float(timearray[2])/3600
        speedkmh = distancekm/timehrs
        totaldistancekm = totaldistancekm + distancekm
        totalspeedkmh = totalspeedkmh + speedkmh
        if(distancekm > maxdistancekm):
                maxdistancekm = distancekm
        if(distancekm < mindistancekm):
                mindistancekm = distancekm
        if(speedkmh > maxspeedkmh):
                maxspeedkmh = speedkmh
        if(speedkmh < minspeedkmh):
                minspeedkmh = speedkmh
print("Your fastest speed is:          ", round(maxspeedkmh,2), " Km/hr")
print("Your longest distance is:    ", round(maxdistancekm,2), " Km")
print("Your slowest speed is:          ",    round(minspeedkmh,2), " Km/hr")
print("Your shortest distance is: ",    round(mindistancekm,2), " Km")
print("Your average speed is:          ", round(totalspeedkmh/n,2), " Km/hr")
print("Your average distance is:    ", round(totaldistancekm/n,2), " Km")
    

    

            

You might also like