用python做超市系统_python超市管理系统(简)

#超市收银系统

num1 =

"1001"

name1 =

"香蕉"

price1 =

3.5

num2 =

"1002"

name2 =

"西瓜"

price2 =

7.5

num3 =

"1003"

name3 =

"哈密瓜"

price3 =

9.9

while

True

:

print

(

"欢迎来到收银系统"

)

num =

input

(

"请输入你要购买的编号"

)

count =

input

(

"请输入你要购买的数量"

)

if

num ==

"1001"

:

price = price1*

float

(

count

)

print

(

"您购买的东西是:"

+name1+

"

价格是:"

+

str

(

price

)

+

"

数量是:"

+

str

(

count

))

break

elif

num ==

"1002"

:

price = price2*

float

(

count

)

print

(

"您购买的东西是:"

+name2+

"

价格是:"

+

str

(

price

)

+

"

数量是:"

+

str

(

count

))

break

elif

num ==

"1003"

:

price = price3*

float

(

count

)

print

(

"您购买的东西是:"

+name3+

"

价格是:"

+

str

(

price

)

+

"

数量是:"

+

str

(

count

))

break

else

:

print

(

"查无此商品,请重新输入"

)

continue

while

True

:

fu =

input

(

"请输入您的付款金额"

)

if

int

(

fu

)

:

print

(

"金额不足,请重新输入"

)

continue

elif

int

(

fu

)

>=price

:

resultzhao =

float

(

fu

)

-price

print("总价:"+str(price)+"

付款:"+str(fu)+"

找您:"+str(resultzhao))

print("欢迎下次光临!")

break

你可能感兴趣的:(用python做超市系统)