Jump to content

Oliver123456

Member
  • Posts

    18
  • Joined

  • Last visited

Awards

This user doesn't have any awards

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Oliver123456's Achievements

  1. I got it from a discord server and unfortunately that is all they have given me. There is another one that has been posted which is much longer, but i still haven't figured out this one.
  2. So I have this cipher which I know what it translates into, but I can't find out how. I also know that the shift changes every letter. Can anyone help? Cipher text: 83X25 Plaintext: Price And the conversion tables: (attached) EDIT: I know of another one, cipher text: JX3X3 Plaintext: NOV87 Thanks!
  3. So I have the H100i RGB Platinum and took off the copper block as I thought that was how you took off the brackets. So it kinda split everywhere but I put the liquid back in there and tightened it up. So would it still be fine or not?
  4. *bump* as I haven't gotten a reply.
  5. How do i put that into my code, and yes test for two users to be authenticated then let them play the game (which i have already written).
  6. So this is probably really obvious, but how do you split a line in a file into two separate strings. My current code is: def authentication(): username = input("Please enter your username") password = input("Please enter your password") for line in open("users.txt","r").readlines(): # Read the lines login_info = line.split() # Split on the space, and store the results in a list of two strings if username == login_info[0] and password == login_info[1]: print("Correct credentials!") rollDieWithPoints() print("Incorrect credentials.") My formatting for my file is 'username, password'. Also how can I change this code so it will accept two users! Thanks!
  7. Sorry for offending you and thanks, the new function is working perfectly.
  8. I have changed it to the new method and what would you like to put there instead?
  9. Thanks, i knew it was a simple solution but not exactly what the solution was!
  10. So i am trying to make it possible so in one function it will define a variable, but above that i need another function to use that same variable (this is because i am calling that fiunction in the first function). How can I do this? import re def rollDieWithPoints(): print("hi") print(user1) print(user2) print("hi again") def authentication(): file = open("users.txt") text = file.read() user1NameInput = input("What is your name user 1?: ") re_res = re.search(r'^{}, (.*)$'.format(user1NameInput), text, re.MULTILINE) if re_res: password = re_res.group(1) user1PasswordInput = input("What is you password user 1?: ") if password == user1PasswordInput: print("Welcome to the game user 1, now for user 2") user2NameInput = input("What is your name user 2?: ") re_res = re.search(r'^{}, (.*)$'.format(user2NameInput), text, re.MULTILINE) if re_res: password = re_res.group(1) userPasswordInput = input("What is you password user 2?: ") if password == userPasswordInput: print("Welcome to the game, now you can both play") user1 = user1NameInput user2 = user2NameInput rollDieWithPoints() else: print("Wrong password, try again") else: newUsernameInput = input("That username is not in the system, would you like to create a new user by that name? (Y/N): ") if newUsernameInput == "Y": file = open("users.txt", "a") newUsernamePasswordInput = input("Please enter your password?: ") file.write("\n" + userNameInput + ", " + newUsernamePasswordInput) file.close() elif newUsernameInput == "N": print("Okay, username incorrect, try again") else: print("That is not an input, please try again") else: print("Wrong password, try again") else: newUsernameInput = input("That username is not in the system, would you like to create a new user by that name? (Y/N): ") if newUsernameInput == "Y": file = open("users.txt", "a") newUsernamePasswordInput = input("Please enter your password?: ") file.write("\n" + userNameInput + ", " + newUsernamePasswordInput) file.close() elif newUsernameInput == "N": print("Okay, username incorrect, try again") else: print("That is not an input, please try again") file.close() def start(): authentication() start() I want the initial definitions to happen in authentication() and then the use to happen in rollDieWithPoints(). Thanks!
  11. I just put in the code again and now it works, thanks everyone who helped out! My code if you want it: import re def authentication(): file = open("users.txt") text = file.read() userNameInput = input("What is your user name?: ") re_res = re.search(r'^{}, (.*)$'.format(userNameInput), text, re.MULTILINE) if re_res: password = re_res.group(1) userPasswordInput = input("What is you password?: ") if password == userPasswordInput: print("You can now play the game") else: print("Wrong password, try again") else: newUsernameInput = input("That username is not in the system, would you like to create a new user by that name? (Y/N): ") if newUsernameInput == "Y": file = open("users.txt", "a") newUsernamePasswordInput = input("Please enter your password?: ") file.write("\n" + userNameInput + ", " + newUsernamePasswordInput) file.close() elif newUsernameInput == "N": print("Okay, username incorrect, try again") else: print("That is not an input, please try again") file.close() def start(): authentication() start()
  12. *Bump*, just bumping this as I haven't got a response.
  13. So i just added it in and it said 'invalid character in identifier', my code is: import re def authentication(): file = open("users.txt") text = file.read() print(text) userNameInput = input("What is your user name?: ") re_res = re.search(r'^{}, (.*)$'.format(userNameInput), text, re.MULTILINE) if re_res: password = re_res.group(1) userPasswordInput = input("What is you password?: ") if password == userPasswordInput: print("You can now play the game") else: print("Wrong password, try again") else: newUsernameInput = input("That username is not in the system, would you like to create a new user by that name? (Y/N): ") if newUsernameInput == "Y": file = open("users.txt", "a") newUsernamePasswordInput = input("Please enter your password?: ") file.write("\n" + userNameInput + ", " + newUsernamePasswordInput) file.close() elif newUsernameInput == "N": print("Okay, username incorrect, try again") file.close() def start(): authentication() start()
  14. Thanks, I'm out at the moment, but as soon as I get back I will try it out!
×