I've got a challenge to write a code to find the maximum in a list of numbers with no usage of such functions as max(), but only using for and if statement.
Hello, guys! So, here is my code:
student_scores = input ("Input a list of scores the students have got till now:\n").split(", ")
print ("Okkay, here is your list of student scores: ", student_scores)
max_ = student_scores[0]
for score in student_scores:
if score > max_:
max_ = score
print (max_)
but if I type such a list:
11, 44, 8, 234
the result is: 8
If I add
int()
function to score and max_ variables, everything is correct. What's going wrong in that case? Help!