All pastes #745214 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-22 04:38 UTC
rendered paste body
/* Instructions here:
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 */

k = 0
j = 0
duplicates = False
while k < len(zipcode_list) - 1:
	while j < len(zipcode_list) - 1:
		if zipcode_list [k] == zipcode_list [j] and j ! = k:
			duplicates = True
			break
		j += 1
	j = 0
	k += 1