Ask Question
13 December, 15:27

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.

+2
Answers (1)
  1. 13 December, 15:42
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers