count=0
while count < 3:
user=input(‘please input username >>‘)
password=input(‘please input passwd >>‘)
if user == ‘yangguang‘ and password == ‘sunshine‘:
print (‘welcome‘)
break
else:
print (‘error user or passwd‘)
count+=1
continue
原文:http://www.cnblogs.com/sunnybible/p/7492414.html