线上订餐系统初步python,2024年最新细节决定成败

先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7

深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年最新大数据全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

如果你需要这些资料,可以添加V获取:vip204888 (备注大数据)
img

正文

    elif option == "3" or option == "dessert":
        SubMenu(D, "dessert")
        purchase.append(Purchase("dessert"))

    elif option == "exit" or option == "4":
        print("")
        return purchase  

    else:
        print("invalid input\n")

def AUT(): # authentication
print(“remember, you can enter “exit” to leave this page”)
cnt = 0
while True:
cnt += 1
name = input(“enter your username:”)
password = input(“enter your password:”)
if name == “exit” or password == “exit”:
return [False, 0]

    elif cnt >= 3:#limit log in times:3
        print("you have logged in for too many times!")
        return [False, 0]

    #searching username and password in json document
    for i in range(len(data)):
        if name == data[i][0] and password == data[i][1]:
            return [True, name]
    print("user name or password incorrect\n")

def Register(): # how to become a vip
name = input(“enter your user name:”)
while True:
password = input(“enter your password:”)
if len(password)<4:
print(“password too short, length should be above 3”)
else:
break
deposit = input(“enter how much to store( must be over 50 pounds):”)

if deposit.isdigit():
    deposit = int(deposit)
    if deposit >= 50:#when the amount is greater than quota
        data.append([name, password, deposit])
        with open("foodShop_VipData.json", "w") as f1:
            json.dump(data, f1)
        print("register successful!\n")
        time.sleep(0.5)
        return True

    else:
        print("deposit should be above 50!")
        return False
else:
    print("invalid input!")
    return False

def PayBill(isVIP, List, username=“”): # is ordered and
if List == [[[]]]: # not ordered
decision=input(“you have not ordered anything yet!\ndo you want to order now?:”)
if decision==“yes”:
return 1 #continue
else:
return 2#exit to main page

else:  #payment section
    Sum=ShowOrder(List)
    if isVIP == True:
        orderList=Modi(List,True,username)
        Sum=ShowOrder(orderList)
        variable = SubroutineVIP(data, username, Sum)
        return 0

    else:
        orderList=Modi(List,False,money)
        Sum=ShowOrder(orderList)
        Subroutine(money, Sum)
        return 0

#modify orderList information
def Modi(orderList,isVIP,username=“”,money=0):
accu=0
print(“add items/delete items/ready to pay”)
choice = input(“enter your choice:”)

if choice == "add items":
    print("enter \"done\" when you ready")
    while True:
        item = input("enter the name of dish:")
        if item=="done":#out of  loop if finished
            print("")
            break

        for foodLst in [S,M,D]:#search if item is in S, M or D
            accu+=FindItem(foodLst,item)#get the price of item
        if accu==0:
            print(f"sorry, we don't have {item}")
        else:#append the items to the order list and then do some output
            orderList[0].append([item,accu])

elif choice == "delete items":
    isIn=False
    print("enter \"done\" when you ready")
    while True:
        itemDelete = input("enter the name of dish to delete:")
        if itemDelete=="done":
            print("")
            break

        for sublst in orderList:
            for info in sublst:
                if itemDelete in info:
                    sublst.remove(info)
                    isIn=True
        if isIn==False:
            print(f"you didn't order {item}")

elif choice == "ready to pay":
    pass

else:
    print("invalid input")

return orderList

def FindItem(category,item):#finds if item is in a multidimentional list and returns the price
for i in category:
for j in i:
if item in j:
return j[1]#returns the price of the item
return 0#when the item is not in the list

def ShowOrder(orderList):
Sum=0
cnt = 1
print(“you have ordered:”)

for i in orderList:
    for j in i:
        print(cnt, ".", j[0])
        Sum += j[1]
        cnt += 1

print(f"{Sum} pounds in total\n")
time.sleep(0.5)
return Sum#the total cost of this meal

#vip payment method
def SubroutineVIP(data, username, moneyRequired): # direct pay first
for b in data:
# deposit is greater than cost
if username in b:
if moneyRequired <= b[2]:
b[2] -= moneyRequired#the money left in account

        else:
            print("sorry, you don't have enough money!")
            print("1.charge money\n2.check balance\n3.cancel order")
            choice=input("enter your choice:")

            if choice=="1" or choice=="charge money":
                dif=moneyRequired-b[2]
                while True:
                    amount=int(input(f"you need at least {dif}pounds:"))
                    if amount<dif:
                        print(amount,"pounds is not enough,still need ",dif-amount,"pounds")
                    else:
                        break

                for info in data:
                    if username in info:
                        info[2]=amount-dif

            elif choice=="3" or choice=="cancel order":#when no enough money in account and not replenish
                print("bill cancelled")
                os._exit(0)
            
            elif choice=="2" or choice=="check balance":
                CheckBalance(username)

            else:
                print("invalid input")

with open("foodShop_VipData.json", "w") as f2:
    json.dump(data, f2)
print("the payment is successful!\n")
return 0  # future adds the name of dishes and interact with other computer or devices

def CheckBalance(username):
for info in data:
if username in info:
print(f"your balance is:{info[2]} pounds")
return 0

def Subroutine(moneyRequired):
moneyPaid = int(input(“enter the money to pay:”))
if moneyRequired <= moneyPaid:
print(“the paymentis successful!”)
print(“return {} pounds back\n”.format(moneyPaid-moneyRequired))
else:
print(“the money is not enough\n”) # later comes up with repay

def Main():
while True:
print(
“********************\n1.VIP channel\n2.normal channel\n3.become a VIP\n4.exit”)

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加V获取:vip204888 (备注大数据)
img

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

需要这份系统化的资料的朋友,可以添加V获取:vip204888 (备注大数据)
[外链图片转存中…(img-fNEAvvUx-1713423129649)]

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值