[2] Just learned some simple exercises for Python and several exercises for python
Python dating entertainment club: 613176398
1. Use a while loop to input 1 2 3 4 5 6 8 9 10
2. Calculate the sum of all numbers from 1
3. Output all odd numbers in 1-100
4. Output all the even numbers in 1-100
5. Calculate the sum of all numbers of 1-2 + 3-4 + 5... 99.
6. User Login (three chances to try again)
Question 1:
a = 0while a < 10: a +=1 if a == 7: continue print(a)
Question 2:
Method 1:
a = 0b = 1while b <= 100: a = a + b b += 1print(a)
Method 2:
a = 0for i in range(101): a = a + i print(a)
Question 3:
a = 0while a <= 100: a += 1 if(a%2) == 0: print(a)
Question 4:
Method 1:
a = 0while a <= 100: a += 1 if(a%2) == 0: print(a-2+1)
Method 2:
a = 0while a <= 99: a += 1 if(a%2) != 0: print(a)
Question 5:
a = 0b = 0while a < 99: a += 1 if a%2 == 1: b += a else: b -= aprint(b)
Question 6:
A = 0 while a <3: name = input ("Enter the User name:") password = input ("enter the password :") a + = 1 if name = 'wxd 'and password = '000000': print ("Login successful") exit () else: print ("input error, enter ") print (" three input errors, exit ") again ")