Path: csiph.com!goblin3!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.124 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.79; '*S*': 0.04; 'else:': 0.03; 'def': 0.13; 'from:addr:xs4all.nl': 0.16; 'function?': 0.16; 'received:194.109': 0.16; 'received:194.109.24': 0.16; 'received:xs4all.nl': 0.16; 'defined': 0.23; 'header:In-Reply- To:1': 0.24; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'wrong': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'header:Message-Id:1': 0.61; 'greetings,': 0.61; 'received:194': 0.61; 'received:nl': 0.72; 'as:': 0.79; 'subject:value': 0.84; 'subject:Check': 0.95 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: Check if a given value is out of certain range From: Michiel Overtoom In-Reply-To: Date: Mon, 5 Oct 2015 10:18:29 +0200 Content-Transfer-Encoding: 7bit References: To: Pyton List X-Mailer: Apple Mail (2.2104) 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: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1444033178 news.xs4all.nl 23858 [2001:888:2000:d::a6]:33099 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:97401 Why not use a function? if outside(x, 0, 10): print("x has wrong value") else: print("x has good value") where 'outside' is defined as: def outside(value, lowerbound, upperbound): return value < lowerbound or value > upperbound Greetings,