repl.it
@Caoyq1992/

Password

Python

No description

fork
loading
Files
  • main.py
main.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
# Varaible for the correct password
correct_password='colab_python'

# The user's password guess

# A vlue to decide if we need to ask the user for new password
keep_going=True

failure_num=3

# The number of attempts
tries=0

# A loop to check the user's password
while(keep_going):
  # Increment of the number of trials
  tries=tries+1;
  print('Try #: ' + str(tries))
  
  # Ask the user for their password
  guess=input('Input your password: ')

  # Check to see if the password is correct
  if guess==correct_password:
    keep_going=False
    print('Success!')
  else:
    keep_going=True


  # If the pasword is incorrect, ask again

  # If the user failed 3rd try, file the missles
  if tries>=failure_num and guess != correct_password:
    keep_going=False
    print('File now')