-1

My Code:

import menus
import functions
import players
def main():
    print("#############################################")
    print("#############################################")
    print("############# - Leaderboard - ###############")
    print("#################### #########################")
    print("[1st Place]", players.one)

    if players.p1 != "Available":
        print("[", players.p1, "]", "Score: ", players.p1B)
    else:

    if players.p2 != "Available":
        print("[", players.p2, "]", "Score: ", players.p2B)
    else:

    if players.p3 != "Available":
        print("[", players.p3, "]", "Score: ", players.p3B)
    else:

    if players.p4 != "Available":
        print("[", players.p4, "]", "Score: ", players.p4B)
    else:

    if players.p5 != "Available":
        print("[", players.p5, "]", "Score: ", players.p5B)
    else:

    if players.p6 != "Available":
        print("[", players.p6, "]", "Score: ", players.p6B)
    else:




    print("#############################################")
    print("#   Please press any key to return to menu  #")
    print("#############################################")
    input()

It returns the following error:

File "C:\Users\xxx\PycharmProjects\bet\leaderboard.py", line 16 if players.p2 != "Available": ^ IndentationError: expected an indented block

Process finished with exit code 1


I import from other files to run but I do not understand this part.

  • 1
    Welcome to SO! Remove all your dangling `else:` blocks. If you use `else:`, there has to be a block of indented code associated with it. – ggorlen Jun 15 '20 at 18:29
  • Read the error, look at line 16, and you should see why. Probably you need `elif`. – Asocia Jun 15 '20 at 18:30

1 Answers1

2

Your else block can't be empty, if you remove it or put some code under it, that should solve the problem. You can also do

else: 
    pass 

But I recommend just removing all of your empty else statements.

harwiltz
  • 261
  • 3
  • 1