Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Scott Montreuil Newsgroups: comp.lang.python Subject: if else python Date: Wed, 25 Nov 2015 03:45:37 +0000 Lines: 31 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de Wu0EHuOMKHS8THN5Wk6tAQocC5Biht1ZJNM0qUcdlaCg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.041 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'else:': 0.03; '40,': 0.09; 'subject:python': 0.14; '"%s': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'true:': 0.16; 'skip:l 30': 0.18; 'why.': 0.18; '%s"': 0.22; 'seems': 0.23; 'figure': 0.27; 'statement': 0.32; 'run': 0.33; 'skip:j 20': 0.33; 'skip:d 20': 0.34; 'unknown': 0.35; 'something': 0.35; 'url:org': 0.36; 'to:addr :python-list': 0.36; 'received:10': 0.37; 'missing': 0.37; 'url :rec-html40': 0.37; 'charset:us-ascii': 0.37; 'received:66': 0.38; 'hi,': 0.38; 'data': 0.39; 'to:addr:python.org': 0.40; 'url:schemas': 0.40; 'url:office': 0.40; 'skip:u 10': 0.61; 'received:10.10': 0.76; 'received:10.10.10': 0.84; 'subject:else': 0.84 Thread-Topic: if else python Thread-Index: AdEnMz5crHJYK4QgRP+dY+xy443jIw== Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.10.10.96] X-Mailman-Approved-At: Wed, 25 Nov 2015 01:10:20 -0500 X-Content-Filtered-By: Mailman/MimeDel 2.1.20+ X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99414 Hi, I have an if statement which seems to run both commands and I cannot figure= out why. (just learning so I may be missing something obvious) Any ideas? while True: global latit,longt,jlatit,jlongt,mlongt,mlatit response =3D urllib.urlopen(url) data =3D json.loads(response.read()) latit =3D data['Data'][0]['Latitude'] longt =3D data['Data'][0]['Longitude'] jlatit =3D data['Data'][1]['Latitude'] jlongt =3D data['Data'][1]['Longitude'] mlatit =3D data['Data'][2]['Latitude'] mlongt =3D data['Data'][2]['Longitude'] for i in user1locat: if float(i[2]) <=3D float(latit) <=3D float(i[3]) and float= (i[4]) >=3D float(longt) >=3D float(i[5]): newlocation =3D int(i[1]) screen.addstr(7, 40, "%s at %s" %(user1, i[0])) motor1thread =3D threading.Thread(target=3Dmotor1) motor1thread.start() screen.refresh() else: screen.addstr(5, 40, "%s is at an unknown location = %f %f\n" % (user1, latit, longt)) newlocation =3D 200 motor1thread =3D threading.Thread(target=3Dmotor1) motor1thread.start() screen.refresh() time.sleep(10)