Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 loop within loop confusion
I'm trying out nested loops. I included the error message I get at the end. I simply cannot see how indentation is inconsistent. Please help

#Program loops
start_for = 3
end_for = 102

for c in range(start_for, end_for,2):
    for x in range(3,10,2):
        if remainder > 0:
            for y in range(2,10):
                remainder = c%y
				if remainder != 0:
print("end program")
#line 15
#if remainder != 0: #TabError: inconsistent use of tabs and spaces in indentation ^
buran wrote Feb-03-2019, 12:48 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
(Feb-03-2019, 12:46 PM)anfaenger Wrote: I simply cannot see how indentation is inconsistent.

We also cannot see as you didn't use Python tags and there is no intentation.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
you mix tabs and spaces for indentation and that is why you get the error. The recommendation is to use spaces (4 spaces).
Most IDE would have option to convert tabs to spaces automatically.
Thank you Buran, you identified the problem. I didn't use tags because I've no idea what they are and how to use them. And yes, I've read the explanation.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to Loop my calculator input Michael1 2 106 Yesterday, 04:57 AM
Last Post: ICanIBB
  List comprehension. Shor for loop version dervast 1 66 Dec-11-2019, 12:34 PM
Last Post: perfringo
  Possible to use asyncio as a faster while loop? JackMack118 1 131 Dec-03-2019, 09:55 PM
Last Post: JackMack118
  MySql - Loop - CHeck File gcclinux 1 82 Nov-30-2019, 11:51 AM
Last Post: ThomasL
  Is it possible to avoid 2 loops inside another loop? SvetlanaofVodianova 2 179 Nov-27-2019, 02:30 PM
Last Post: Gribouillis
  Using loop for getting data in several List quyenca 4 189 Nov-26-2019, 04:36 PM
Last Post: quyenca
  number repeating twice in loop JonnyEnglish 3 120 Nov-24-2019, 09:23 AM
Last Post: ThomasL
  While loop doesn't end when False Kanashi 2 114 Nov-21-2019, 02:38 AM
Last Post: Kanashi
  Running function from parent module which has a loop in it. ta2909i 1 81 Nov-18-2019, 07:04 PM
Last Post: Gribouillis
  For loop in my __init__ doesn't work as expected Jessy 2 100 Nov-18-2019, 10:07 AM
Last Post: buran

Forum Jump:

Users browsing this thread: 1 Guest(s)