亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

狗屁不通的購物車

發布時間:2020-07-17 06:56:03 來源:網絡 閱讀:155 作者:魂逗蘿 欄目:編程語言

#倉庫類
class Repository():
l = {'屠戮之刃':[3900,20],
'無影劍-艾雷諾':[3788,22],
'子午×××劍':[3899,19],
'劍神梁月的鈍劍':[3688,22]}
def add(self, one):
if list(one.name.keys())[0] not in Repository.l:
Repository.l[list(one.name.keys())[0]] = list(one.name.values())
else:
a = one.name
b = list(a.keys())[0]
Repository.l[b][-1] += 1
print('完成')
def sub(self, one):
if list(one.name.keys())[0] not in Repository.l:
print('沒有該商品')

    elif list(one.name.keys())[0] == 1:
        Repository.l.remove(one.name)
    else:
        a = one.name
        b = list(a.keys())[0]
        Repository.l[b][-1] -= 1
        print()

def show(self):
    n = 0
    for i,k in Repository.l.items():
        n += 1
        print('%d 商品:%-14s\t價格:%-5s \t數量:%-3s' % (n,i, k[0],k[-1]))

class Commdity(Repository):
def init(self, name = None, price = None, count = None):
self.name = name
self.price = price
self.count = count

def shop(self):
    return Repository.l

#用戶類
class Customer():
sala =50000
def chongzhi(self, money):
Customer.sala = Customer.sala + int(money)
print('充值成功,現在共有%s元' % self.sala)

#登錄類
class Loggin(Customer):
ls = {('1','2'):3}
def init(self, cid, pwd, name = None):
self.cid = cid
self.pwd = pwd
self.name = name

def login(self):
        if (self.cid, self.pwd) in list(Loggin.ls.keys()):
            print('登錄成功')
            return Loggin(self.cid,self.name, self.pwd)

        else:
            print('賬號密碼輸入錯誤')
            return

class Logup():
def logup(self, pwd, name):
import random
while True:
cids = random.randint(10000,99999)
if cids not in Loggin.ls:
Loggin.ls[str(cids),pwd] = name
print('注冊成功')
print('你的賬號:\nid:%-10s\n密碼:%-10s\n 名字:%-10s' % (cids,pwd,name))
break
else:
continue

#購物車
class Shopcar(Customer):
l = {}
def add(self, one):
if Customer.sala <= list(one.name.values())[0][0]:
print('請充值')
else:
if list(one.name.keys())[0] not in Shopcar.l:
print('yes')
Shopcar.l[list(one.name.keys())[0]] = list(one.name.values())[0]
Customer.sala -= list(one.name.values())[0][0]
print('購買完成,你的商品都有%s,余額:%s元' % (Shopcar.l,Customer.sala) )

        else:
            print(Shopcar.l[list(one.name.keys())[0]])
            Shopcar.l[list(one.name.keys())[0]][-1] += 1
            Customer.sala -= list(one.name.values())[0][0]

            print('購買完成,你的商品都有%s,余額:%s元' % (Shopcar.l,Customer.sala) )
def sub(self, one):
    if list(one.name.keys())[0] not in Shopcar.l:
        print('沒有對應的商品')

    elif Shopcar.l[list(one.name.keys())[0]][-1] == 1:
        Shopcar.l.remove(list(one.name.keys())[0])
        Customer.sala += list(one.name.values())[0][0]
        print('移除成功,你的商品都有%s,余額:%s元' % (Shopcar.l,Customer.sala) )
    else:
        Shopcar.l[list(one.name.keys())[0]][-1] -= 1
        Customer.sala += list(one.name.values())[0][0]
        print('移除成功,你的商品都有%s,余額:%s元' % (Shopcar.l,Customer.sala) )

#裝備接口類
class Someequ():
def init(self, name):
self.name = name
def out_equ(self):
return self.name

#接口類
class Io():
def trans(self, inputs, choices):
if choices == '1':
return {'屠戮之刃':[3900,0]}
elif choices == '2':
return {'無影劍-艾雷諾':[3788,0]}
elif choices == '3':
return {'子午×××劍':[3899,0]}
elif choices == '4':
return { '劍神梁月的鈍劍':[3688,0]}
else:
print('無效參數')
#輸入類
class Log():
def id(self):
ids = input('請輸入id:')
return ids
def mima(self):
ma = input('請輸入密碼:')
return ma
def mingzi(self):
mz= input('請輸入名字:')
return mz
def xuanxiang(self):
xx = input('請輸入選項:')
return xx
def xuanze(self):
xz = input('請選擇:')
return xz

print('歡迎光臨'.center(50,'*'))
while True:
print('請選擇注冊或者登錄')
print('1. 注冊')
print('2. 登錄')
log = Log()
xx = log.xuanxiang()
if xx == '1':
#注冊
print('歡迎注冊')
b = log.mima()
c = log.mingzi()
loggin = Logup()
logs2 =loggin.logup(b,c)
continue
elif xx == '2':
#登錄
print('請先登錄')
a = log.id()
b = log.mima()
loggin = Loggin(a,b)
logs = loggin.login()
if logs != None:
while True:
print('請選擇選項:')
print('1.充值')
print('2.購買商品 ')
print('3.移除商品')
print('4.退出')
log = Log()
xx = log.xuanxiang()
if xx == '1':
#充值
log = Log()
xz = log.xuanze()
chongzhi = Customer()
chongzhi.chongzhi(xz)

            elif xx == '2':
                #購買
                commdity = Commdity()
                shoplist = commdity.shop()
                repository = Repository()
                repository.show()
                log = Log()
                xz = log.xuanze()
                io = Io()
                ios = io.trans(shoplist,xz)
                pack_equ = Someequ(ios)
                shopcar = Shopcar()
                shopcar.add(pack_equ)
                repository.sub(pack_equ)
            elif xx == '3':
                #移除
                commdity = Commdity()
                shoplist = commdity.shop()
                repository = Repository()
                repository.show()
                log = Log()
                xz = log.xuanze()
                io = Io()
                ios = io.trans(shoplist,xz)
                pack_equ = Someequ(ios)
                shopcar = Shopcar()
                shopcar.sub(pack_equ)
                repository.add(pack_equ)

            elif xx == '4':
                #退出
                print('歡迎下次光臨')
                exit()
            else:
                print('無效的選擇。請重新選擇')
                print('')
    else:
        print('請重新輸入')
        input('')
else:
    print('無效的選擇,請重新輸入')
    input('')
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

志丹县| 鞍山市| 赞皇县| 金秀| 阆中市| 新龙县| 瑞金市| 兴业县| 武强县| 永兴县| 景东| 华安县| 香河县| 景德镇市| 花莲市| 吉首市| 武定县| 四平市| 怀宁县| 雅江县| 隆昌县| 安国市| 普兰店市| 沈丘县| 金湖县| 德清县| 吕梁市| 唐山市| 丁青县| 宣威市| 偃师市| 衡水市| 凭祥市| 沁源县| 巫溪县| 灵宝市| 丰台区| 渝中区| 临洮县| 内黄县| 广水市|