Python Leaderboard [on hold]
Multi tool use
My friends and I have been struggling on this project, and we've come to a part where we need to create a 'Leaderboard' function in which the program displays the top 5 players who've scored the highest in the game.
def register():
file = open("accounts.txt", "a")
accounts =
print("You will now register yourself to the quiz.")
firstname = input(str("Enter your first name: "))
surname = input(str("Enter your surname: "))
age = input("Enter your age: ")
password = input("Enter the password you would like to use: ")
username = ((surname[0]+surname[1]+surname[2]) + (firstname[0]+firstname[1]) + age)
print("Your username is: " + username)
score = "0"
file.write(username + " " + password + " " + firstname + " " + surname + " " + age + " " + score + "n")
def login():
check = open("accounts.txt","r")
username = input("Please enter your username ")
password = input("Please enter your password ")
for line in open("accounts.txt","r").readlines():
login_info = line.split()
if username == login_info[0] and password == login_info[1]:
print("Correct credentials!")
print("n")
choice2 = input("Press 1 for leaderboard, 2 to play OR 3 to EXIT.")
if choice2 == "1":
leaderboard()
elif choice2 == "2":
game()
elif choice2 == "3":
quit
else:
print("Invalid.")
return True
print("Incorrect credentials.")
return False
print("----------------------------------------------")
print("nWelcome to the Music Quiz!")
choice1 = input("Press 1 for login, press 2 for register, press 3 for leaderboard, press 4 to EXIT ")
if choice1 == "1":
login()
elif choice1 == "2":
register()
elif choice1 == "3":
leaderboard()
elif choice1 == "4":
quit
else:
print("Invalid")
The rest of the program works fine, we just need to add a 'leaderboard' section; preferably after the 'register' function.
python game pygame
New contributor
put on hold as off-topic by Simon Forsberg♦ 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Simon Forsberg
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
My friends and I have been struggling on this project, and we've come to a part where we need to create a 'Leaderboard' function in which the program displays the top 5 players who've scored the highest in the game.
def register():
file = open("accounts.txt", "a")
accounts =
print("You will now register yourself to the quiz.")
firstname = input(str("Enter your first name: "))
surname = input(str("Enter your surname: "))
age = input("Enter your age: ")
password = input("Enter the password you would like to use: ")
username = ((surname[0]+surname[1]+surname[2]) + (firstname[0]+firstname[1]) + age)
print("Your username is: " + username)
score = "0"
file.write(username + " " + password + " " + firstname + " " + surname + " " + age + " " + score + "n")
def login():
check = open("accounts.txt","r")
username = input("Please enter your username ")
password = input("Please enter your password ")
for line in open("accounts.txt","r").readlines():
login_info = line.split()
if username == login_info[0] and password == login_info[1]:
print("Correct credentials!")
print("n")
choice2 = input("Press 1 for leaderboard, 2 to play OR 3 to EXIT.")
if choice2 == "1":
leaderboard()
elif choice2 == "2":
game()
elif choice2 == "3":
quit
else:
print("Invalid.")
return True
print("Incorrect credentials.")
return False
print("----------------------------------------------")
print("nWelcome to the Music Quiz!")
choice1 = input("Press 1 for login, press 2 for register, press 3 for leaderboard, press 4 to EXIT ")
if choice1 == "1":
login()
elif choice1 == "2":
register()
elif choice1 == "3":
leaderboard()
elif choice1 == "4":
quit
else:
print("Invalid")
The rest of the program works fine, we just need to add a 'leaderboard' section; preferably after the 'register' function.
python game pygame
New contributor
put on hold as off-topic by Simon Forsberg♦ 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Simon Forsberg
If this question can be reworded to fit the rules in the help center, please edit the question.
3
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Simon Forsberg♦
2 days ago
This is also hypothetical code, with functions that are being called that aren't defined. Also, such a simple game login is not secure at all.
– FreezePhoenix
2 days ago
add a comment |
My friends and I have been struggling on this project, and we've come to a part where we need to create a 'Leaderboard' function in which the program displays the top 5 players who've scored the highest in the game.
def register():
file = open("accounts.txt", "a")
accounts =
print("You will now register yourself to the quiz.")
firstname = input(str("Enter your first name: "))
surname = input(str("Enter your surname: "))
age = input("Enter your age: ")
password = input("Enter the password you would like to use: ")
username = ((surname[0]+surname[1]+surname[2]) + (firstname[0]+firstname[1]) + age)
print("Your username is: " + username)
score = "0"
file.write(username + " " + password + " " + firstname + " " + surname + " " + age + " " + score + "n")
def login():
check = open("accounts.txt","r")
username = input("Please enter your username ")
password = input("Please enter your password ")
for line in open("accounts.txt","r").readlines():
login_info = line.split()
if username == login_info[0] and password == login_info[1]:
print("Correct credentials!")
print("n")
choice2 = input("Press 1 for leaderboard, 2 to play OR 3 to EXIT.")
if choice2 == "1":
leaderboard()
elif choice2 == "2":
game()
elif choice2 == "3":
quit
else:
print("Invalid.")
return True
print("Incorrect credentials.")
return False
print("----------------------------------------------")
print("nWelcome to the Music Quiz!")
choice1 = input("Press 1 for login, press 2 for register, press 3 for leaderboard, press 4 to EXIT ")
if choice1 == "1":
login()
elif choice1 == "2":
register()
elif choice1 == "3":
leaderboard()
elif choice1 == "4":
quit
else:
print("Invalid")
The rest of the program works fine, we just need to add a 'leaderboard' section; preferably after the 'register' function.
python game pygame
New contributor
My friends and I have been struggling on this project, and we've come to a part where we need to create a 'Leaderboard' function in which the program displays the top 5 players who've scored the highest in the game.
def register():
file = open("accounts.txt", "a")
accounts =
print("You will now register yourself to the quiz.")
firstname = input(str("Enter your first name: "))
surname = input(str("Enter your surname: "))
age = input("Enter your age: ")
password = input("Enter the password you would like to use: ")
username = ((surname[0]+surname[1]+surname[2]) + (firstname[0]+firstname[1]) + age)
print("Your username is: " + username)
score = "0"
file.write(username + " " + password + " " + firstname + " " + surname + " " + age + " " + score + "n")
def login():
check = open("accounts.txt","r")
username = input("Please enter your username ")
password = input("Please enter your password ")
for line in open("accounts.txt","r").readlines():
login_info = line.split()
if username == login_info[0] and password == login_info[1]:
print("Correct credentials!")
print("n")
choice2 = input("Press 1 for leaderboard, 2 to play OR 3 to EXIT.")
if choice2 == "1":
leaderboard()
elif choice2 == "2":
game()
elif choice2 == "3":
quit
else:
print("Invalid.")
return True
print("Incorrect credentials.")
return False
print("----------------------------------------------")
print("nWelcome to the Music Quiz!")
choice1 = input("Press 1 for login, press 2 for register, press 3 for leaderboard, press 4 to EXIT ")
if choice1 == "1":
login()
elif choice1 == "2":
register()
elif choice1 == "3":
leaderboard()
elif choice1 == "4":
quit
else:
print("Invalid")
The rest of the program works fine, we just need to add a 'leaderboard' section; preferably after the 'register' function.
python game pygame
python game pygame
New contributor
New contributor
New contributor
asked 2 days ago
Ali RakhadaAli Rakhada
1
1
New contributor
New contributor
put on hold as off-topic by Simon Forsberg♦ 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Simon Forsberg
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by Simon Forsberg♦ 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Simon Forsberg
If this question can be reworded to fit the rules in the help center, please edit the question.
3
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Simon Forsberg♦
2 days ago
This is also hypothetical code, with functions that are being called that aren't defined. Also, such a simple game login is not secure at all.
– FreezePhoenix
2 days ago
add a comment |
3
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Simon Forsberg♦
2 days ago
This is also hypothetical code, with functions that are being called that aren't defined. Also, such a simple game login is not secure at all.
– FreezePhoenix
2 days ago
3
3
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Simon Forsberg♦
2 days ago
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Simon Forsberg♦
2 days ago
This is also hypothetical code, with functions that are being called that aren't defined. Also, such a simple game login is not secure at all.
– FreezePhoenix
2 days ago
This is also hypothetical code, with functions that are being called that aren't defined. Also, such a simple game login is not secure at all.
– FreezePhoenix
2 days ago
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
6YJHf088dDnUJO SMtxetUPP cjUjS BpQoJTtFZyhhS1mm6CuaKDLsBcie xBNZY 0 9vmF,4rZzjlDYQbV8XNOnI
3
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Simon Forsberg♦
2 days ago
This is also hypothetical code, with functions that are being called that aren't defined. Also, such a simple game login is not secure at all.
– FreezePhoenix
2 days ago