Skip to content

Instantly share code, notes, and snippets.

@rishi93
Last active February 23, 2016 14:52
Show Gist options
  • Save rishi93/5901c77284eafddc8d9a to your computer and use it in GitHub Desktop.
Save rishi93/5901c77284eafddc8d9a to your computer and use it in GitHub Desktop.
rfid shopping basket
from urllib import urlopen
url = "http://data.sparkfun.com/input/7JAm8EYLolf0yYZ2xolq?private_key=mzVy8NMJp4TyX1j0mVRK&rfid_code=" #GET request
def checkIfAlreadyPresent(arr,item):
for i in arr:
if item == i:
return True
return False
arr = []
done = False
while(not done):
item = int(input("Enter item code"))
if item == -1:
done = True
for i in arr:
sendResponse = url + str(i)
result = urlopen(sendResponse).read()
print(result)
break
if(checkIfAlreadyPresent(arr,item)):
arr.remove(item)
else:
arr.append(item)
print(arr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment