Ask Question
29 November, 06:49

You are given a variable named zipcode_list that has been defined and refers to a list of postal codes. Write some code that assigns True to duplicates if any two elements in the list have the same value, but that otherwise assigns False to duplicates. You may, if you wish, use two other variables, j and k. Use only j, k, zipcode_list, and duplicates.

+4
Answers (1)
  1. 29 November, 07:11
    0
    Since I'm using the other two variables, the coding will be as follows;

    duplicates = False

    j = 0

    while j < len (zipcode_list) - 1 and not duplicates:

    k = j + 1

    while k < len (zipcode_list) and not duplicates:

    if zipcode_list[k] = = zipcode_list[j]:

    duplicates = True

    k + = 1

    j + = 1
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “You are given a variable named zipcode_list that has been defined and refers to a list of postal codes. Write some code that assigns True ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers