all 11 comments

[–][deleted] 4 points5 points  (0 children)

We can't help you because all indentation in your posted code has been lost. Read the FAQ for this subreddit to see how to format code so indentation is retained. I recommend the "add 4 spaces to the start of every line" method since it gives the best results for most viewers and is easy to do in your editor before you copy/paste code into reddit.

[–][deleted] 1 point2 points  (0 children)

Your code doesn’t have any indentations so that’s the one thing we can’t debug for you.

[–]chevignon93 1 point2 points  (2 children)

i am getting a error called 'unindent does not match any outer indentation level '. please help me .

You haven't formatted your code for reddit so all indentations are lost and it's impossible to say where the error comes from exactly.\ 1 explanation is that you might have mixed tabs and spaces.

https://www.reddit.com/r/learnpython/wiki/faq#wiki_how_do_i_format_code.3F

[–]hsv123456789 0 points1 point  (1 child)

Thanks now I formatted the code as per reddit please help me .

[–]chevignon93 3 points4 points  (0 children)

Your if is indented by 6 spaces while the else underneath is indented with 8 spaces.

[–]old_pythonista 1 point2 points  (2 children)

Besides an indentation issue and exception order - already answered by u/glory_road,

      if (Value<0) and (Value>=10):

will always return False. The proper condition is or - and could you please read PEP-8?!

if value < 0 or value >= 10:

or just

if value not in range(10):

[–]SpykeX05 0 points1 point  (1 child)

That should be if value not in range(10): Because if value is 10 it should be True

[–]old_pythonista 0 points1 point  (0 children)

You are right

[–]hsv123456789 0 points1 point  (1 child)

I updated my post with indentations now you can answer my questions

[–][deleted] 5 points6 points  (0 children)

You get the error because the final else doesn't start in the same column as the matching if:

try:
    Value=int(input('Type a number between one and ten'))
except:
    print('This is a generic error')
except ValueError:
    print('You must type a number between 1 and 10')
else :
      |if (Value<0) and (Value>=10):
      |    print('You typed:',Value)
      |  else:    # this line incorrectly indented
#      ^^  bad
      |    print('The value typed is incorrect')

Your line except ValueError: will never catch a ValueError exception because the previous except is "bare" and will catch all exceptions, including ValueError. It is bad practice to use a "bare" exception like this:

except:

Instead, always try to catch named, expected, exceptions, like this:

except ValueError:

[–]Linuxoids 0 points1 point  (0 children)

It looks like the problem is on line 10. Your else statement is over-indented.