Python loop and pythonfor Loop
Password ciphertext passwd. py
Import getpass
_ Username = 'sunny'
Password = '000000'
Username = input ("username :")
Password = getpass. getpass ("password :")
If _ username = username and _ password = password:
Print ("Welcome to {name} login...". format (name = username ))
Else:
Print ("Invalid username or password ")
Guess. py
Age = 56
Count = 0
While count <4:
Guess_age = int (input ("guess age :"))
If guess_age = age:
Print ("Congratulations! ")
Break
Elif guess_age> age:
Print ("ops ...")
Else:
Print ("devops ...")
Count + = 1
If count = 3:
Continue_flag = input ("do you want to keep ...")
If continue_flag! = 'N'
Count = 0
Else:
Print ("......")
While. py
Count = 0
While True:
Print ("count:", count)
Count + = 1
Exce1.py
For I in range (10 ):
/* Range (0, 10, 2)
0 ~ 10, step 2
*/
Print ("loop:", I)
For j in range (10 ):
Print (j)
If j> 5:
Break