Python realizes express price query system

The examples in this article share the specific code of python to realize the express price query system for your reference. The specific content is as follows

1. Code

#- - author--Zhang Junjie@Nick
# system hint
print("Welcome to the express system!")
# Endless loop
while1==1:
# Simple interaction, type in values
 weight=int(input("Please enter the weight (kg):"))
 num=input("Please enter the location number (1.Other 2.Three provinces/Ningxia/Qinghai/Hainan 3.Xinjiang/Tibet 4.Hong Kong, Macau and Taiwan/foreign):")
# Define parameters
 p=0
# If judgment, judgment weight, more than 3 kg, excluding 3 kg
 if weight 3:if num=="1":
 p=10+5*(weight-3)#10 heads of state heavy price+The excess part is 5 yuan per kilogram, similar to the following
 elif num=="2":
 p=12+10*(weight-3)#12 heads of state value price+10 yuan per kilogram for the excess
 elif num=="3":
 p=20+20*(weight-3)#20 heads of state heavy price+20 yuan per kilogram for the excess
 elif num=="4":
 # Hong Kong, Macau, Taiwan and foreign countries need to contact the head office
 p=100000print("Please contact the head office")else:print("input error")
 #3 Under kg
 elif weight<=3 and weight 0:if num=="1":
 p=10#10 heads of state heavy price
 elif num=="2":
 p=12#12 heads of state value price
 elif num=="3":
 p=20#20 heads of state heavy price
 # Hong Kong, Macau and Taiwan, shipping is not accepted
 elif num=="4":
 p=100000print("Not accept shipment")else:print("input error")else:print("input error")

# Output the express price
 print("Hello, the price of this package is:",p,"yuan")

Two, summary

The price of express delivery will change according to the different services of each express company. You can consider using condition judgments in the program and embed the calculation of express delivery prices of different express companies.

The editor will share a piece of code for you: Python express charging applet, here also thank the original author for sharing:

# Demand: express freight calculation table. 1. Shaan-Gan-Ning 7 yuan per kilogram. 2. Xinjiang and Tibet are 10 yuan per kilogram. 3. 3 blocks for the rest

def mean():print("Welcome to express calculator")print("1;Shan Gan Ning 7 yuan per kilogram.")print("2;Xinjiang and Tibet are 10 yuan per kilogram.")print("3;3 yuan for the rest.")

def select():
 out =int(input("Please enter the place you choose:"))return out

def shan_gan_ning():
 out =int(input("Please enter the kilograms of the goods:"))print("Fees payable:")print(out*7)

def xing_xi():
 out =int(input("Please enter the kilograms of the goods:"))print("Fees payable:")print(out*10)

def qiyu():
 out =int(input("Please enter the kilograms of the goods:"))print("Fees payable:")print(out*3)

def main():
 exit_name = True
 while exit_name:mean()
 key =select()if key ==1:shan_gan_ning()
 elif key ==2:xing_xi()
 elif key ==3:qiyu()
 elif key ==4:
 exit_name = False
 else:print("Please enter the correct value!")main()

For more learning materials, please pay attention to the topic "Management System Development".

The above is the whole content of this article, I hope it will be helpful to everyone's study.

Recommended Posts

Python realizes express price query system
Python realizes business card management system
Python3 realizes business card management system
Python realizes the development of student management system
Python realizes spaceship war
Python realizes stitching pictures
Python realizes online translation
Python realizes tank battle
Python realizes online translation function
Python implements parking management system
Python realizes apple eating game
Python realizes the guessing game
Python realizes 3D map visualization
Python implements car management system
Python realizes batch naming photos