#using while loop Output 1 2 3 4 5 6 8 9Count = 1 whileCount <= 10: ifCount = = 7: Count+ = 1Continue Print(count) Count+ = 1#all numbers of the 1-100 are calculated andCount = 1sum=0 whileCount <= 100: Sum+=Count Count= Count + 1Print(sum)#Find all the odd numbers within 1-100Count = 1 whileCount <= 100: Print(count) Count= Count + 2#all even numbers in the output 1-100Count = 1 whileCount <= 100: Count+ = 1Print(count) Count+ = 1#To 1-2+3-4+5...99 all the numbers andCount = 1sum1= 1sum2= 1 whileCount < 100: Count+ = 1sum1+=Count Count+ = 1sum2+=CountPrint(sum2-sum1)#User Login (three chance retry)n = 1 forCountinch{1,2,3,4}: ifN < 4: Name= Input ("Please enter your account number") Password= Input ('Please enter your password:') Else: Print('retry more than 3 times, please try again later') Continue ifName = ='Mao' andPassword = ='Chun': Print('welcome into the New World .') Break Else: Print('you have incorrectly lost your account password%s times'%N)Print('Please re-enter your account number and password') n= n + 1
Python Learning Exercise 1