Python Forum
My very first "thing" what I'm somewhat proud of, after a week udomy class. Register
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My very first "thing" what I'm somewhat proud of, after a week udomy class. Register
#1
import time
def log_in ():
    return ()

print("Register:")
ui = []
pw = []
while True == 1:
	userid = input("Give you User name: " )
	password = input("Give your password: ")
	
	if userid in ui:
			print('Userid already in use!')
			True == 1
	else:
		print('You registered successfully!!')
		ui.insert(0, userid)
		pw.insert(0, password)
		print (ui)
		print (pw)
		#True == 1
		break
time.sleep(2)
import os 
os.system('clear')
while True == 1:
	print("Log In:")
	if input("User ID: ") in ui:
	       	if input("Password: ") in pw:
	       		print("Succesfull LogIn!")
	       		
	       		import webbrowser
	       		webbrowser.open('http://www.youtube.com', new=2)
	       		break
	       		True == 4
	       	else:
	       		print("Wrong User name or password!! Try again!!")
Reply
#2
Pretty good for one week keep going
just a quick tip tho make your code more readable first off by using a linter as with imports it a better practice to put them all at the top of the file
A linted python code should look like this
import os
import time


def log_in():
    return ()


print("Register:")
ui = []
pw = []
while True == 1:
    userid = input("Give you User name: ")
    password = input("Give your password: ")

    if userid in ui:
        print('Userid already in use!')
        True == 1
    else:
        print('You registered successfully!!')
        ui.insert(0, userid)
        pw.insert(0, password)
        print(ui)
        print(pw)
        #True == 1
        break
time.sleep(2)
os.system('clear')
while True == 1:
    print("Log In:")
    if input("User ID: ") in ui:
        if input("Password: ") in pw:
            print("Succesfull LogIn!")

            import webbrowser
            webbrowser.open('http://www.youtube.com', new=2)
            break
            True == 4
        else:
            print("Wrong User name or password!! Try again!!")
I just put that in my editor (Visual studio code) and it linted it on save
Reply
#3
Hey this is an awesome script you wrote, I am also new to programming. Just trying to get an early headstart before I get to my programming class. So I ran your script from pycharm, I created a username and password that you made with the input function. After a successful login, it opened up my web browser and took me to youtube. Keep up the good work, you learn much faster then I do, your lucky your smart.
Reply
#4
You can write password and username in a text file and you dont need sing up every time
(sorry for bad english)
Reply
#5
Also you can make its a gui
Reply
#6
couple of things. basically this code could not possibly run.
it looks like you try to use True as variable name, because you try to assign value to True, e.g. 1, 4, etc. Don't do that.
True is keyword, a built-in constant. It's strange if your code does not raise SyntaxError. It should raise SyntaxError
Error:
>>> True=1 File "<stdin>", line 1 SyntaxError: can't assign to keyword
Next, what is the purpose of
def log_in():
    return ()
not that you need a function if you need empty tuple.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  My very first "thing" what I'm somewhat proud of, after a week udomy class. Register Haulpa 3 2,546 Jun-19-2020, 09:02 PM
Last Post: Haulpa
  my first attempt, please advise me of any thing danak 6 3,830 Feb-01-2020, 03:19 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020