while True:
name = raw_input("please input your name:")
if name == 'dingwei':
password = raw_input("please input your password:")
while password != 'cbh':
password = raw_input("please input your password:")
print "----------------------------------"
print "welcome to login to system!"
print "------------------------------------"
else:
print "user %s not found,try again!" % name
continue
self_sal = int(raw_input("please store your money:"))
while True:
if self_sal > 0:
print '--------------------------------------------'
print 'you had stored %s successfully!' % self_sal
break
elif self_sal == 0:
self_sal = int(raw_input("you store your money failure ,please store money again:"))
continue
else:
self_sal = int(raw_input("you store your money failure ,please store money again:"))
continue
while True:
choose = ''
purchase = raw_input('Do you want to shop(yes/no):%s' % choose)
if purchase == 'yes':
for i in objects:
print i,' ',prices[objects.index(i)]
elif purchase == 'no':
print '------------------------------------'
print 'you had exited system successfully!'
break
else:
continue
choice = raw_input('Please input one item to buy:')
F_choice = choice.strip()
while True:
if F_choice in objects:
objects_index = objects.index(F_choice)
objects_price = prices[objects_index]
print F_choice,objects_price
if self_sal > objects_price:
shop_list.append(F_choice)
print 'Added %s into shop list' % F_choice
self_sal = self_sal - objects_price
print "Salary left:",self_sal
break
else:
if self_sal < min(prices):
print 'Sorry,rest of your salary cannot buy anything!88'
print "you hava bought these things: %s" % shop_list
break
else:
print "Sorry,you cannot afford this product,please try other ones!"
print "-----------------------------------------------------------------"
choice = raw_input('please input one item to buy:')
F_choice = choice.strip()
continue
else:
print "Not such products!Please input one item to buy again!"
print "-----------------------------------------------------------------"
choice = raw_input('please input one item to buy:')
F_choice = choice.strip()
continue
break