First, using the while loop output 1, 2, 3, 4, 5, 6 8, 9, 10
Count = 0 while count<10: + = 1 if count==7 :continue Print(count)
Sum of all the numbers of the two and 1-100
Count = 1= 0 while Count <=: = sum +count + = 1< C18>print(SUM)
Three, all odd numbers of output 1-100
Count = 1 while Count <=: if count%2!=0: Print(count) Count+=1
Iv. all even numbers of output 1-100
Count = 1 while Count <=: if count%2==0: Print (count) + = 1
V. Output 1+2+3+...+99 and
Count = 1= 0 while Count <=: = count + sum + = 1print( Sum
Six, user login, three opportunities
Count =0username="Andraw_wu"Password="123" whileCount <= 2: _username= Input ("Enter user name") _password= Input ("Enter Password") ifUsername = = _username andPassword = =_password:Print("Landing Success") Break Else: Print('Logon Failure') Count+ = 1Else: Print("too many logins, can only log on three times")
Python Exercises (i)