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

Life of Brian: Conjugate the verb, "to go" !
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
  Two variables in for loop vipinv23 3 65 Yesterday, 07:57 AM
Last Post: DeaD_EyE
  Breaking subprocess loop from parent process kapibara 2 101 Aug-19-2019, 10:17 AM
Last Post: Gribouillis
  Operations on indexed variables in loop Fibulavie 1 76 Aug-14-2019, 06:07 AM
Last Post: fishhook
  how do i loop a "def ..." when error occurs? Stan2292 0 65 Aug-12-2019, 05:28 AM
Last Post: Stan2292
  Get all values of for loop with an index BollerwagenIng 2 154 Aug-09-2019, 07:58 AM
Last Post: BollerwagenIng
  Setting maximum value of Range() in For loop pmt 4 217 Aug-04-2019, 02:38 PM
Last Post: pmt
  While loop kasper1903 4 214 Aug-03-2019, 06:27 PM
Last Post: jefsummers
  How can I sort my names of files in for loop? Mike Ru 2 130 Aug-02-2019, 04:56 AM
Last Post: perfringo
  Loop through List jeran042 5 158 Jul-30-2019, 05:25 PM
Last Post: ichabod801
  Loop do not start for letter matching algoritm phob0s 3 129 Jul-29-2019, 04:31 PM
Last Post: ThomasL

Forum Jump:

Users browsing this thread: 1 Guest(s)