亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 2439 | 回復(fù): 1
打印 上一主題 下一主題

如何跳出當(dāng)前循環(huán)進(jìn)入“上一個(gè)”循環(huán) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2016-01-08 23:01 |只看該作者 |倒序?yàn)g覽
小弟新手,在編寫(xiě)ATM程序,某段代碼思路如下:
修改密碼:
1、輸入老密碼,若與老密碼不同則continue
2、輸入新密碼,密碼必須6位數(shù)字
3、再次輸入新密碼,密碼必須6位數(shù)字
判斷兩次新密碼是否相同,若不同,跳回2 輸入新密碼,然后再到3再次輸入新密碼。
代碼如下:
  1. while True:
  2.     choice = raw_input("Please input which of your choice: ")
  3.     if choice == "1":
  4.         while True:
  5.             oldpassword = int(raw_input("Please input your oldpassword: "))
  6.             if oldpassword != userinfo[login][0]:
  7.                 print "Input error,Please input again!"
  8.             else:
  9.                 global newpassword
  10.                 newpassword = 0
  11.                 while True:
  12.                     try:
  13.                         newpassword = int(raw_input("Please input your newpassword,must be six: "))
  14.                     except ValueError:
  15.                                                 print "Must be six numbers"
  16.                     if len(str(newpassword)) != 6:
  17.                         continue
  18.                     else:
  19.                         global newpasswordagain
  20.                         newpasswordagain = 0
  21.                         while True:
  22.                             try:
  23.                                 newpasswordagain = raw_input("Please input your newpassword again,must be six: ")
  24.                             except ValueError:
  25.                                 print "Must be six numbers"
  26.                             if newpassword != newpasswordagain:
  27.                                 print "newpassword is not equal newpassword again"
復(fù)制代碼
請(qǐng)問(wèn)如何實(shí)現(xiàn)
判斷兩次新密碼是否相同,若不同,跳回2 輸入新密碼,然后再到3再次輸入新密碼。

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2016-01-09 21:06 |只看該作者
  1. while True:
  2.     choice = raw_input("Please input which of your choice: ")
  3.     if choice == "1":
  4.         while True:
  5.             inputpassword = int(raw_input("Please input your oldpassword: "))
  6.             if inputpassword != oldpassword:
  7.                 print "Input error,Please input again!"
  8.             else:
  9.                 break
  10.         global newpassword
  11.         newpassword = 0
  12.         while True:
  13.             newpassword = int(raw_input("Please input your newpassword,must be six: "))
  14.             if len(str(newpassword)) != 6:
  15.                 print "Must be six numbers"
  16.             else:
  17.                 break
  18.         global newpasswordagain
  19.         newpasswordagain = 0
  20.         while True:
  21.             newpasswordagain = int(raw_input("Please input your newpassword again,must be six: "))
  22.             if newpassword != newpasswordagain:
  23.                 print "newpassword is not equal newpassword again"
  24.             else:
  25.                 break
復(fù)制代碼
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP