Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: error help import random Date: Fri, 20 Nov 2015 11:10:49 -0700 Lines: 15 Message-ID: References: <8b0ec311-ab7f-429d-877f-d205ad6008d9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de SzReWtgcy9+/bV/JPUMHZgry5ostuS1f5aYiW7zZijUg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.056 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:help': 0.07; 'python': 0.10; 'subject:error': 0.11; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:import': 0.16; 'subject:random': 0.16; 'wrote:': 0.16; 'integer': 0.18; '2015': 0.20; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'error': 0.27; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'code': 0.30; 'run': 0.33; 'received:google.com': 0.35; 'nov': 0.35; 'but': 0.36; 'instead': 0.36; 'received:209.85': 0.36; 'possible': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'total': 0.62; 'here.': 0.62; 'between': 0.65; '20,': 0.66; 'fortune': 0.66; 'inclusive': 0.84; 'otten': 0.84; 'riley': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=QYlXWSJui0v3ugQtDqW3oX31Mdgdvqp0Gas/8WOTRns=; b=szygZeLrNNf3osH9GMQyKlHdmiV/VWgokPC3u72jm2WESTGvcdfQQ1hn8StMvP1ZLu cqs4b+hyHjmSsoA1ECLnSAJpveDrH4y/hYR2CFk0TJ7wNTAPen64keWEsBYyMlDakUJq NdXPOu1c79zf+PcOxbC6y+CiUs4kV24aFDM8K+Cq2Mj/DfkQJTgBOqGhCrB6ETlaF7LV bwbhYLiuZdfqrSmca+0tWfF0hufoz9SsNUJ8SlSWR93q8YfDUm1JSB3CnkUEzyidXA6R qISa6fexQXYFYkZRnk/3R8P0FuBm4iYlJmBh+SBmrnWRUhgpNTfPVPO68iDgfL7LDGMk ZgVA== X-Received: by 10.107.137.226 with SMTP id t95mr14832015ioi.188.1448043088922; Fri, 20 Nov 2015 10:11:28 -0800 (PST) In-Reply-To: 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:99177 On Fri, Nov 20, 2015 at 10:57 AM, Peter Otten <__peter__@web.de> wrote: > Dylan Riley wrote: > >> input("\nPress enter to see your fortune") > > Make sure that you run your code with Python 3, not Python 2. Or if you must use Python 2, use raw_input() instead of input(). >> fortune = random.randrange(6) + 1 Also, you have an off-by-one error here. randrange(6) will give you an integer between 0 and 5, inclusive (a total of 6 possible values). Adding 1 will then result in an integer between 1 and 6, inclusive, but you don't have a case for a value of 6.