Ask Question
17 November, 13:38

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. 17 November, 13:46
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers