亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我這個用面向過程怎么寫

我這個用面向過程怎么寫

qq_木魚_14 2017-09-13 01:13:00
shopping_list = [ ? ?('Watch', 10000), ? ?('Ihpone', 5800), ? ?('Bicycle', 800), ? ?('Python_book', 65), ? ?('Coffee', 31),]good_list = []salary = input("Input your salary:")def user(): ? ?'''定義用戶''' ? ?for index, item in enumerate(shopping_list): ? ? ? ?print(index, item) ? ?user_choice = input('Input your buy some of product:')def unmber( ): ? ?'''定義unmber這個函數是程序看起來更簡化''' ? ?user() ? ?x = salary ? ?y = user_choice ? ?z = shopping_list ? ?while True: ? ? ?if x.isdigit() or y.isdigit(): ? ? ? ? ? ?x = int(x) ? ? ? ? ? ?y = int(y) ? ? ? ? ? ?if x < len(z) and x >= 0: ? ? ? ? ? ? ? ?s = p_item = z[x] ? ? ? ? ? ? ? ?if s[1] <= x: ? ? ? ? ? ? ? ? ? ?z.append(s) ? ? ? ? ? ? ? ? ? ?x -= s[1] ? ? ? ? ? ? ? ? ? ?print("Added %s in to shopping cart," ? ? ? ? ? ? ? ? ? ? ? ? ?"you current balance is \033[31;1m%s\033[0m"%(s,x)) ? ? ? ? ? ? ? ?else: ? ? ? ? ? ? ? ? ? ?print("your current balance not to buy is %s"%x) ? ? ? ? ? ?else: ? ? ? ? ? ? ? ?print("Your choice in outside shopping_list") ? ? ?elif x or y == 'q': ? ? ? ? ?print('Wlecome again') ? ? ?else: ? ? ? ? ?print('Invalid Option') ? ?return unmber( )
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1214 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號