Path: csiph.com!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweak.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed7.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.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'repeated': 0.07; 'api': 0.09; 'script,': 0.09; 'subject:script': 0.09; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'precede': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'wrote:': 0.16; 'runs': 0.18; 'wrote': 0.23; 'tried': 0.24; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'script': 0.25; 'header:User-Agent:1': 0.26; 'print': 0.30; 'received:84': 0.32; 'running': 0.34; 'reply.': 0.35; 'but': 0.36; 'should': 0.36; 'lines': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'say': 0.37; 'thanks': 0.37; 'times.': 0.38; 'skip:p 20': 0.38; 'mean': 0.38; 'subject:the': 0.39; "didn't": 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'more': 0.63; 'here:': 0.63; 'times': 0.63; 'reply': 0.68; 'upper': 0.76; "'for'": 0.84; 'url:programming': 0.84; 'robot': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=MbeRwMLf c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=IkcTkHD0fZMA:10 a=SJe_thOIAAAA:8 a=BFy3_k40l7BAecBm35EA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 Subject: Re: my first script for the GoPiGo To: python-list@python.org References: From: MRAB Date: Thu, 22 Oct 2015 17:40:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1445532055 news.xs4all.nl 23743 [2001:888:2000:d::a6]:54481 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:97908 On 2015-10-22 16:45, input/ldompeling@casema.nl wrote: > In reply to "MRAB" who wrote the following: > >> On 2015-10-22 16:07, input/ldompeling@casema.nl wrote: >> > I want that this script runs to times from the upper line to the buttom >> > line. >> > I tried with for x in range(2): but that didn't work >> >> You say "didn't work", but in what way didn't it work? >> >> > The GoPiGo is a small robot on wheels. >> > >> > The API codes are here: >> > http://www.dexterindustries.com/GoPiGo/programming/ >> > python-programming-for-the- >> > raspberry-pi-gopigo/ >> > >> > >> > from gopigo import * >> > import time >> > > Thanks or the reply. > > I mean that i want this script running two times. > So the first line is mindist = 70 > And the last line is print x > And that two times > So that the robut continues moving two times in this script, from the upperline > to the bottum line two times. > Then just indent those lines and precede them with the 'for' line. > >> > for x in range (2): >> >> The lines to be repeated should be indented more than the 'for' line. >> >> > mindist = 70 >> > servo(120) >> > time.sleep(2) >> > fwd() >> > stop() >> > time.sleep(2) >> > bwd() >> > stop() >> > if mindist > us_dist(15): >> > bwd() >> > stop >> > print x >> >