Code: Alles auswählen
import random
import re
#Guest Number
number = random.randint(1023,9999)#The Random Numbers for Guest####
def Register():
with open('DataList/DataList.txt') as f: #opens the DataList folder and the Txt file it contains
data = f.read() #reads the Txt file
for user in data:
UserName = input("Enter your Username: ")
if UserName in data:#checks if the username is in Data
print("UserName already exist!")# If yes the output will be print
continue
elif not UserName in data:#If the username is not in the txt file
print("Username ok!")#this is output
continue
elif len(UserName) <= 3:#must not be smaller than 3
print("Username is to Short")
continue
elif len(UserName) >= 18:#must not be greater than 18
print("Username is to long")
# while not UserName:#If Input empty output this
# UserName = input("Please input your Username: ")
#Program query
while True:
UserInput = input("Hello Guest#{numbers} Do you have a Account y/n: ".format(numbers=number))#Query whether an account exists or not
if UserInput == "n":#If not give `n` a
Register()
# elif UserInput == "y":#If yes then enter `y`
# Login()
else:
print("None Valid form!")#If the input does not apply at all or is given