Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62681

Re: Variables in a loop, Newby question

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python.': 0.02; 'tutorial': 0.03; 'variables': 0.07; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; '24,': 0.16; 'be:': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'trying': 0.19; 'email addr:gmail.com&gt;': 0.22; 'python?': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'lets': 0.24; 'cc:2**0': 0.24; 'handling': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; '(on': 0.31; 'this.': 0.32; 'python.org': 0.32; 'stuff': 0.32; 'url:python': 0.33; 'sense': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'var': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'little': 0.38; 'url:mail': 0.40; 'how': 0.40; 'numbers': 0.61; 'first': 0.61; 'to:addr:gmail.com': 0.65; 'started.': 0.68; 'results': 0.69; 'joel': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=GBJZIJVJuf9VObOS03Q1yZgCHHo1+Sph+8n0YiPD1+o=; b=jeNJdCwmS3kK2raz+pm6TnazqfVL3YM3exOb7Z2QP4DnC/h5lMbRm9LOaOgF1+HqaB R1RGKrfh0a9+regwxI68OFhPjnCGOOSSnx6a2IWS7OPNDJ9gQ6Ix4euRs4CEduGH2OaP 7ZDJKCKIqzm6/ExlD8ykiBexM+JrCXpdK8xsgXLogQzQKSo+WrTe/zYcSadtkx9B+qFm XOTj9kVJ9vYH4xmz1DimIrKSCfqctOswkG+FmtDKqXYLQ/Ax6OXNU31zkqxsM5wFBs9S nwZ837qpOru24MJVcOuXkXwUfFXml9tPlG8hB8qxzqnOkXNhI9/U4KLtIOy0JC9Y4NWE 5K0g==
MIME-Version 1.0
X-Received by 10.52.72.227 with SMTP id g3mr16862vdv.93.1387902046807; Tue, 24 Dec 2013 08:20:46 -0800 (PST)
In-Reply-To <9ad01eef-baf0-4018-833e-0b4dce4b9b85@googlegroups.com>
References <9ad01eef-baf0-4018-833e-0b4dce4b9b85@googlegroups.com>
Date Tue, 24 Dec 2013 11:20:46 -0500
Subject Re: Variables in a loop, Newby question
From Joel Goldstick <joel.goldstick@gmail.com>
To vanommen.robert@gmail.com
Content-Type multipart/alternative; boundary=bcaec50165257c444204ee4a2098
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4596.1387902055.18130.python-list@python.org> (permalink)
Lines 99
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387902055 news.xs4all.nl 2966 [2001:888:2000:d::a6]:44511
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62681

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Dec 24, 2013 at 11:07 AM, <vanommen.robert@gmail.com> wrote:

> Hello, for the first time I'm trying te create a little Python program.
> (on a raspberri Pi)
>
> I don't understand the handling of variables in a loop with Python.
>
>
> Lets say i want something like this.
>
> x = 1
> while x <> 10
>         var x = x
>         x = x + 1
>
> The results must be:
>
> var1 = 1
> var2 = 2
>
> enz. until var9 = 9
>
> How do i program this in python?
> --
> https://mail.python.org/mailman/listinfo/python-list
>

You might want to go to python.org and check out the documentation.  I
don't really understand what you are trying to do.  The var1, var2 stuff
doesn't make sense

In python you can loop like this:

for x in range(10):
  print x

This will print the numbers from 0 to 9.

But your best bet is to find a brief tutorial to get started.



-- 
Joel Goldstick
http://joelgoldstick.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Variables in a loop, Newby question vanommen.robert@gmail.com - 2013-12-24 08:07 -0800
  Re: Variables in a loop, Newby question Joel Goldstick <joel.goldstick@gmail.com> - 2013-12-24 11:20 -0500
  Re: Variables in a loop, Newby question "Tobias M." <tm@tobix.eu> - 2013-12-24 17:24 +0100
  Re: Variables in a loop, Newby question Peter Otten <__peter__@web.de> - 2013-12-24 17:29 +0100
  Re: Variables in a loop, Newby question bob gailer <bgailer@gmail.com> - 2013-12-24 12:26 -0500
  Re: Variables in a loop, Newby question vanommen.robert@gmail.com - 2013-12-24 09:54 -0800
    Re: Variables in a loop, Newby question Joel Goldstick <joel.goldstick@gmail.com> - 2013-12-24 13:10 -0500
    Re: Variables in a loop, Newby question Dave Angel <davea@davea.name> - 2013-12-24 13:42 -0500
    Re: Variables in a loop, Newby question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-12-25 13:35 -0500
  Re: Variables in a loop, Newby question vanommen.robert@gmail.com - 2013-12-24 10:27 -0800
    Re: Variables in a loop, Newby question Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-25 02:54 +0000
      Re: Variables in a loop, Newby question Cameron Simpson <cs@zip.com.au> - 2013-12-25 16:42 +1100
        Re: Variables in a loop, Newby question Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-25 15:27 +0000
          Re: Variables in a loop, Newby question Cameron Simpson <cs@zip.com.au> - 2013-12-26 12:01 +1100
          Re: Variables in a loop, Newby question Chris Angelico <rosuav@gmail.com> - 2013-12-26 12:35 +1100
            Re: Variables in a loop, Newby question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-26 16:41 +1100
              Re: Variables in a loop, Newby question Dave Angel <davea@davea.name> - 2013-12-26 03:14 -0500
              Re: Variables in a loop, Newby question Chris Angelico <rosuav@gmail.com> - 2013-12-26 19:24 +1100
    Re: Variables in a loop, Newby question Peter Otten <__peter__@web.de> - 2013-12-25 15:52 +0100
    Re: Variables in a loop, Newby question Michael Torrie <torriem@gmail.com> - 2013-12-25 23:34 -0700
  Re: Variables in a loop, Newby question Larry Hudson <orgnut@yahoo.com> - 2013-12-25 00:13 -0800
  Re: Variables in a loop, Newby question vanommen.robert@gmail.com - 2013-12-27 00:53 -0800
    Re: Variables in a loop, Newby question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-12-27 11:39 -0500

csiph-web