-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday4.py
More file actions
73 lines (55 loc) · 1.42 KB
/
Copy pathday4.py
File metadata and controls
73 lines (55 loc) · 1.42 KB
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
67
68
69
70
71
72
73
"""i = 0
while i <= 10:
print(i)
i = i + 1
print('end of loop')"""
#print 10 to 1
"""i = 10
while i >= 1:
print(i)
i = i - 1
print('end of loop')"""
#find sum of first 10 natural numbers
"""i = 1
sum = 0
while i <= 10:
sum = sum + i
i = i + 1
print(sum)"""
#print multiplication table of a number
"""num = int(input("Enter a number "))
i = 1
while i <= 10:
print(i, "*",num, "= ", i * num)
i = i + 1"""
#print even nos between 10 to 20
"""i =10
while i <= 20:
if i % 2 == 0:
print(i)
i = i + 1"""
#print first n even numbers
"""
i = 2
n = int(input("Enter a number "))
print(f'First {n} even numbers')
while i <= n*2:
if i % 2 == 0:
print(i)
i = i + 1"""
#create a simple authentication system using while
# loop and if else statement(print the entered username and password and repeatedly ask correct username and password if entered wrong)
username = 'jishnu123'
password = '12345678'
success = False
while success == False:
user = input("Enter username: ")
passw = input("Enter password: ")
if user == username and passw == password:
success = True break is not alwaws good if there are another whiel loops inside main one
print("Authentication successful")
else:
print("Wrong username and password")
print(user)
print(passw)
print("Enter correct username and password")