老師,請我們寫一支小程式。 在一個list裡的數字,找出最大數字。
# 🚨 Don't change the code below 👇
student_scores = input("Input a list of student scores ").split()
for n in range(0, len(student_scores)):
student_scores[n] = int(student_scores[n])
print(student_scores)
# 🚨 Don't change the code above 👆
Coding - Teacher Angela
student_scores = input("Input a list of student scores ").split()
for n in range(0, len(student_scores)):
student_scores[n] = int(student_scores[n])
print(student_scores)
highest_score = 0
for score in student_scores:
if score > highest_score:
highest_score = score
print(f"The highest score in the class is: {highest_score}")
Coding 1 - Student Laurence
student_scores = input("Input a list of student scores ").split()
for n in range(0, len(student_scores)):
student_scores[n] = int(student_scores[n])
print(student_scores)
a = 0
for i in student_scores:
if (i > a):
a = i
print(f"The highest score in the class is: {a}")
我在這一個練習題,卡住了一些時間。 我知道,要做什麼,但我卻不知道,該怎麼下手(coding)。
最後,靠強力隊友Tim的提示,才知道該由什麼方向著手。
我的邏輯思考,還有待加強。 How to think like a programmer?
Coding 2 - Student Laurence