Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Quizzma Latest Articles

8.3.5 Max In List CodeHS Answers

We thoroughly check each answer to a question to provide you with the most correct answers. Found a mistake? Tell us about it through the REPORT button at the bottom of the page. Ctrl+F (Cmd+F) will help you a lot when searching through such a large set of questions.

/The most common answer is:

your function should return the maximum value in my_list
my_list = [1, 3, 456, 2038]
def max_int_in_list(my_list):
highest = my_list[-1]
for num in my_list:
if num > highest:
highest = num
return highest
biggest_int = max_int_in_list(my_list)
print (biggest_int)

The max_int_in_list function is correctly set up to find and return the maximum value in my_list. The function initializes highest with the last item of the list and iterates through my_list to find the maximum value.

Here is the code, correctly formatted:

my_list = [1, 3, 456, 2038]

def max_int_in_list(my_list):
    highest = my_list[-1]
    for num in my_list:
        if num > highest:
            highest = num
    return highest

biggest_int = max_int_in_list(my_list)
print(biggest_int)

This approach correctly identifies 2038 as the maximum value in the list [1, 3, 456, 2038].

Was this helpful?




Quizzma Team

Quizzma Team

The Quizzma Team is a collective of experienced educators, subject matter experts, and content developers dedicated to providing accurate and high-quality educational resources. With a diverse range of expertise across various subjects, the team collaboratively reviews, creates, and publishes content to aid in learning and self-assessment.
Each piece of content undergoes a rigorous review process to ensure accuracy, relevance, and clarity. The Quizzma Team is committed to fostering a conducive learning environment for individuals and continually strives to provide reliable and valuable educational resources on a wide array of topics. Through collaborative effort and a shared passion for education, the Quizzma Team aims to contribute positively to the broader learning community.

Related Posts

Leave a comment