Re: Nested Loop Code Help

2020-01-26 Thread DL Neil via Python-list
On 27/01/20 1:53 PM, Richard Damon wrote: On 1/26/20 6:52 PM, DL Neil via Python-list wrote: On 27/01/20 4:15 AM, ferzan saglam wrote: Hello people, I have written the code below which works fine, but it has one small problem. Instead of printing one (x) on the first line, it prints two. I ha

Re: Nested Loop Code Help

2020-01-26 Thread Richard Damon
On 1/26/20 6:52 PM, DL Neil via Python-list wrote: On 27/01/20 4:15 AM, ferzan saglam wrote: Hello people, I have written the code below which works fine, but it has one small problem. Instead of printing one (x) on the first line, it prints two. I have tried everything in my knowledge, but ca

Re: Nested Loop Code Help

2020-01-26 Thread DL Neil via Python-list
On 27/01/20 4:15 AM, ferzan saglam wrote: Hello people, I have written the code below which works fine, but it has one small problem. Instead of printing one (x) on the first line, it prints two. I have tried everything in my knowledge, but cannot fix the problem. Thanks for any help in advance.

Re: Nested Loop Code Help

2020-01-26 Thread Richard Damon
On 1/26/20 6:11 PM, Greg Ewing wrote: On 27/01/20 4:15 am, ferzan saglam wrote: for x in range ( 0, 10):    stars = 'x'    count = 0 By the way, this 'for' loop is unnecessary. The end result is just to give initial values to three names. You don't need a loop at all for that, just three assign

Re: Nested Loop Code Help

2020-01-26 Thread Greg Ewing
On 27/01/20 4:15 am, ferzan saglam wrote: for x in range ( 0, 10): stars = 'x' count = 0 By the way, this 'for' loop is unnecessary. The end result is just to give initial values to three names. You don't need a loop at all for that, just three assignment statements.

Re: Nested Loop Code Help

2020-01-26 Thread Richard Damon
On 1/26/20 10:15 AM, ferzan saglam wrote: Hello people, I have written the code below which works fine, but it has one small problem. Instead of printing one (x) on the first line, it prints two. I have tried everything in my knowledge, but cannot fix the problem. Thanks for any help in advance.

Re: Nested Loop Code Help

2020-01-26 Thread ferzan saglam
On Sunday, January 26, 2020 at 3:26:40 PM UTC, Dan Purgert wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > ferzan saglam wrote: > > Hello people, I have written the code below which works fine, but it > > has one small problem. Instead of printing one (x) on the first line, > > it p

Re: Nested Loop Code Help

2020-01-26 Thread Dan Purgert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 ferzan saglam wrote: > Hello people, I have written the code below which works fine, but it > has one small problem. Instead of printing one (x) on the first line, > it prints two. > I have tried everything in my knowledge, but cannot fix the problem

Re: Nested Loop Triangle

2017-05-25 Thread Jason Friedman
> > I need the triangle to be in reverse. The assignment requires a nested > loop to generate a triangle with the user input of how many lines. > > Currently, I get answers such as: (A) > > OOO > OO > O > > When I actually need it to be like this: (B) > > OOO >OO > O > Try the

Re: Nested Loop to Generate Triangle

2017-05-25 Thread MRAB
On 2017-05-25 17:28, Victor Demelo wrote: I need the triangle to be in reverse. The assignment requires a nested loop to generate a triangle with the user input of how many lines. Currently, I get answers such as: OOO OO O When I actually need it to be like this: OOO OO O I j

Re: Nested Loop to Generate Triangle

2017-05-25 Thread Peter Pearson
On Thu, 25 May 2017 09:28:31 -0700 (PDT), Victor Demelo wrote: > I need the triangle to be in reverse. The assignment requires a nested > loop to generate a triangle with the user input of how many lines. > > Currently, I get answers such as: > > OOO > OO > O > > When I actually need it to be

Re: Nested Loop to Generate Triangle

2017-05-25 Thread Victor Demelo
On Thursday, May 25, 2017 at 12:28:45 PM UTC-4, Victor Demelo wrote: > I need the triangle to be in reverse. The assignment requires a nested loop > to generate a triangle with the user input of how many lines. > > Currently, I get answers such as: > > OOO > OO > O > > When I actually need

Re: Nested Loop to Generate Triangle

2017-05-25 Thread Victor Demelo
On Thursday, May 25, 2017 at 12:28:45 PM UTC-4, Victor Demelo wrote: > I need the triangle to be in reverse. The assignment requires a nested loop > to generate a triangle with the user input of how many lines. > > Currently, I get answers such as: > > OOO > OO > O > > When I actually need

Re: Nested loop not working

2010-07-16 Thread Alf P. Steinbach /Usenet
* Johann Spies, on 16.07.2010 16:34: I am overlooking something stupid. I have two files: one with keywords and another with data (one record per line). I want to determine for each keyword which lines in the second file contains that keyword. The following code is not working. It loops throu

Re: Nested loop not working

2010-07-16 Thread Dave Angel
Johann Spies wrote: I am overlooking something stupid. I have two files: one with keywords and another with data (one record per line). I want to determine for each keyword which lines in the second file contains that keyword. The following code is not working. It loops through the second fil

Re: Nested loop not working

2010-07-16 Thread MRAB
Johann Spies wrote: I am overlooking something stupid. I have two files: one with keywords and another with data (one record per line). I want to determine for each keyword which lines in the second file contains that keyword. The following code is not working. It loops through the second fil

Re: Nested loop not working

2010-07-16 Thread Ian Kelly
On Fri, Jul 16, 2010 at 8:34 AM, Johann Spies wrote: > I am overlooking something stupid. > > I have two files: one with keywords and another with data (one record per > line). > > I want to determine for each keyword which lines in the second file > contains that keyword. > > The following code

Re: Nested loop

2005-11-30 Thread Bengt Richter
On 30 Nov 2005 00:37:43 -0800, [EMAIL PROTECTED] wrote: > >viewcharts wrote: >> I am reading two text files comparing the values in one to the other, >> this requires two loops. The problem is that when the inner loop is >> finished, it never goes back into the loop. Any suggestions? >> >> >> for

Re: Nested loop

2005-11-30 Thread Micah Elliott
> Micah Elliott wrote: > > On Nov 29, viewcharts wrote: > >>I am reading two text files comparing the values in one to the other, > >>this requires two loops. > > > > Or you could have a look at difflib. > > http://docs.python.org/lib/differ-examples.html On Nov 30, Steve Holden wrote: > Indeed,

Re: Nested loop

2005-11-30 Thread Steve Holden
Micah Elliott wrote: > On Nov 29, viewcharts wrote: > >>I am reading two text files comparing the values in one to the other, >>this requires two loops. > > > Or you could have a look at difflib. > > http://docs.python.org/lib/differ-examples.html > Indeed, but I personally don't see a way to

Re: Nested loop

2005-11-30 Thread Micah Elliott
On Nov 29, viewcharts wrote: > I am reading two text files comparing the values in one to the other, > this requires two loops. Or you could have a look at difflib. http://docs.python.org/lib/differ-examples.html -- _ _ ___ |V|icah |- lliott <>< [EMAIL PROTECTED] "

Re: Nested loop

2005-11-30 Thread Scott David Daniels
Steve Holden wrote: > [EMAIL PROTECTED] wrote: >> viewcharts wrote: >> >>> I am reading two text files comparing the values in one to the other, >>> this requires two loops. The problem is that when the inner loop is >>> finished, it never goes back into the loop. Any suggestions? >>> >>> for refSy

Re: Nested loop

2005-11-30 Thread Steve Holden
[EMAIL PROTECTED] wrote: > viewcharts wrote: > >>I am reading two text files comparing the values in one to the other, >>this requires two loops. The problem is that when the inner loop is >>finished, it never goes back into the loop. Any suggestions? >> >> >>for refSymbol in symbols.readlines():

Re: Nested loop

2005-11-30 Thread bonono
viewcharts wrote: > I am reading two text files comparing the values in one to the other, > this requires two loops. The problem is that when the inner loop is > finished, it never goes back into the loop. Any suggestions? > > > for refSymbol in symbols.readlines(): > for lookupSymbol in myfil

Re: Nested loop

2005-11-30 Thread Juho Schultz
viewcharts wrote: > I am reading two text files comparing the values in one to the other, > this requires two loops. The problem is that when the inner loop is > finished, it never goes back into the loop. Any suggestions? > > > for refSymbol in symbols.readlines(): > for lookupSymbol in my