将输入与多维数组元素进行比较

时间:2015-12-12 00:23:00

标签: python if-statement multidimensional-array

def Intro():     打印(" ************* ********** \ n您想要做什么?\ n \ n \ tZ \ t = \ t按邮政编码的总销售额\ n \ tC \ t = \ t按咖啡类型划分的总销售额\ n \ tG \ t = \ t获取所有咖啡销售额的总销售额\ n \ tHZ \ t = \ t按邮政编码获得最高销售额\ n \ tHC \ t = \ t按咖啡类型销售最高销售额\ n \ t \ t = \ t = \ tExit \ n *********************************************** *******&#34)

邮政编码总计

def Code_Totals(Items,Code_Amounts):      Zipcode =输入("输入邮政编码:\ t")

email

def Main():                               #Item name Itemprince     Items = [[" Cafe Mocha"," Cafe Latte"," Cafe Regular"," Cafe Regular Decaf"," Cafe焦糖色和#34;],[3.50,4.00,2.50,2.50,4.50]]        #Array type邮编Mocha / Latte / Regular / Decaf / Caramel 0/1/2/3/4/5     Code_Amounts = [[48093,48088,48026,48066],[180270240200],[100330310230],[200160450350],[180150100110],[150250320360]]     介绍()     选择=输入("输入您的选择==> \ t")

number

main()的

1 个答案:

答案 0 :(得分:0)

def Code_Totals(Code_Amounts,Zipcode):
    if Zipcode == Code_Amounts[0][0]:
        print("Hello")
def Main():
    Code_Amounts=[[48093,48088,48026,48066],[180,270,240,200],[100,330,310,230],    [200,160,450,350,],[180,150,100,110],[150,250,320,360]]
zipcode=input("Enter the zip code:\t")
Code_Totals(Code_Amounts,zipcode)

Main()

Def无效且Zipcode应为zipcode