Question: #using python 3 import random def login(name,password): file = open(loginsystem.txt,r) for i in file: a,b = i.slpit(',') b = b.strip() if(a==name and b==password): success=True break
#using python 3
import random def login(name,password): file = open("loginsystem.txt","r") for i in file: a,b = i.slpit(',') b = b.strip() if(a==name and b==password): success=True break file.close() if(success): print("you are now logged in") else: print("wrong password or username try again") def register(name,password): file = open("loginsystem.txt","a") file.write(" "+name+","+password) file.close() ) def function(choice): if(choice=="login"): name = input("Enter your name: ") password = input ("Enter your password: ") login(name,password) else: print("Enter your Name and password to register" ) name = input("Enter your name: ").lower() lname =input("Enter your last name: ").lower() num = random.randint(100,999) name = name[0] + lname + str(num)# print('Your user name is :',name)# password = input ('Enter your password:') if len(password)> 6: password2 = input('re_enter password:') if password2 == password: print (password2) register(name,password) def start(): global choice choice = input ("Do you want to login or regeister? (login,register):") if(choice!="login"and choice!="register"): start() start() function(choice)
Error code:
Traceback (most recent call last): File "C:/Users//Desktop/python/mini project2/mini2.1.py", line 53, in function(choice) File "C:/Users//Desktop/python/mini project2/mini2.1.py", line 30, in function login(name,password) File "C:/Users//Desktop/python/mini project2/mini2.1.py", line 7, in login a,b = i.slpit(',') AttributeError: 'str' object has no attribute 'slpit'
Question: i need help fixing my error code i have no clue how to fix it. send me a fixed version of my code please and thanks.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
