Skip to content

Instantly share code, notes, and snippets.

@emerak
Created February 6, 2013 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emerak/4719246 to your computer and use it in GitHub Desktop.
Save emerak/4719246 to your computer and use it in GitHub Desktop.
Basic Operators - LearnPython.org
x = object()
y = object()
# change this code
x_list = [x] * 10
y_list = [y] * 10
big_list = x_list + y_list
print "x_list contains %d objects" % len(x_list)
print "y_list contains %d objects" % len(y_list)
print "big_list contains %d objects" % len(big_list)
# testing code
if x_list.count(x) == 10 and y_list.count(y) == 10:
print "Almost there..."
if big_list.count(x) == 10 and big_list.count(y) == 10:
print "Great!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment