-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chat.py
66 lines (63 loc) · 1.67 KB
/
Chat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#Chat Application Regisration
import sys
print "Do you want to Sign Up or Sign In?"
print "Press U for Sign Up!"
print "Press I for Sign In!"
ch = input("Enter your Response: ")
print (ch)
if (ch == 'U'):
f = open('my.txt', 'a+')
name = input ("Enter your desired username = ")
name = name.encode()
position = 0
str = f.read()
if name in str:
print "Username is taken"
print "Please choose another username"
exit()
else:
print "Username not Found"
f.write(name)
age = input("Enter your age = ")
if(age < '13' or age > '60'):
print"You are not allowed"
exit()
else:
print"You are allowed"
f.write(age)
f.close()
f1 = open('my1.txt' , 'a+')
password = input("Make your password(6 Characters only) = ")
l = len(password)
if(l > '6'):
print "Password should be 6 Characters"
exit()
else:
print "Password is 6 Characters"
print "Your Username and password is saved"
f1.write(password)
f1.close()
elif (ch == 'I'):
f = open('my.txt', 'a+')
name1 = input("Enter your username = ")
name1 = name1.encode()
position = 0
str = f.read()
if name1 in str:
print('Found')
else:
print("Wrong Username!!")
exit()
f.close()
f1 = open('my1.txt', 'a+')
password1 = input("Enter your password = ")
password1 = password1.encode()
position = 0
str = f1.read()
if password1 in str:
print('Found')
print("Correct!")
else:
print("Wrong Password!!")
exit()
f1.close()