1.使用while循環輸入123456 8910登錄
n = 1循環
while n < 11密碼
if n == 7tab
passwhile
elseab
print(n)
n= n + 1
2.求1-100內全部數的和。
n = 1
s = 0
while n < 101
s= s + n
n= n + 1
print(s)
3.輸出1-100內全部的奇數
n = 1
while n < 101
temp = n % 2
if temp == 0
pass
else
print(n)
n= n + 1
4.輸出1-100內全部偶數
n = 1
while n < 101
s= n % 2
if s == 0
pass
else
print(n)
n= n + 1
5.求1-2+3-4...99的全部數的總和
n = 1
s = 0
while n < 100
temp = n % 2 求餘數
if temp == 0
s = s - n
else
s = s + n
print(s)
n= n + 1 都在條件語句下按一次tab建
6. 用戶登陸(三次機會重試)
n = 1
while n < 4
mm == "密碼‘’
if mm == ‘’密碼「
print("能夠登陸」)
else
n = n + 1
print(結束)