#Beginner - Python Loops

#To check your email account is secure or not, it not, that will show you what websites are related to your insecure email account as user registry

So, what is insecure common password ? 最好不要使用, 以免後悔莫及.

  1. day5-1.py
fruits = ["Apple","Peach", "Pear"]
#this is a for loop to iterate each item of list
for friut in fruits:
    print(friut)
    print(friut + " Pie")
  1. day5-2-average-heights.py
#Input a list of student heights separate by blank space. 178 177 188 160 177 190

student_heights = input("Input a list of student heights separate by blank space. ").split()
#Iterate list item in for loop
for n in range(0,len(student_heights)):
    student_heights[n]
    print(student_heights[n])

#***Write code without use len() and sum() function***
total_height = 0 # total heights of all students
number_of_student = 0 # caculate how many students in list
for height in student_heights:
    #print(int(height))
    total_height = total_height + int(height)
    number_of_student +=1

print(f"total_height={total_height}")
print(f"total_student={number_of_student}")
average_height = round(total_height / number_of_student,2)
print(f"average_height={average_height}")
  1. day5-3-highest-score.py
student_scores = [78.65,89,86,55,91,64,89]
#不使用max()函式, 透過 for loop 完成算出最大值
highest_score = 0
for score in student_scores:
		#如果當前的score 大於 之前的最高分數, 則將 score 的值 assign 給 highest_score
    if score > highest_score:
        highest_score = score
print(f"The highest score in the class is : {highest_score}")