Python 游乐场门票购买 简单的if-else系统

print("Welcome to AMUSEMENT PARK")

num = int(input("Input numbers of people:"))

i = 0

prices = []

while i < num:

    print("Select person " + str(i + 1) + "'s type:")

    print("1. Adult")

    print("2. Child")

    print("3. Military card owner")

    print("4. Disability card owner")

    type_ = int(input(''))

    if type_ == 1:

        price = 100

    elif type_ == 2:

        price = 50

    elif type_ == 3:

        price = 30

    elif type_ == 4:

        price = 0

    else:

        print("Error input")

        continue

    prices.append(price)

    i += 1

total = sum(prices)

print("Sum of the tickets: " + str(num))

print("Total price: " + str(total))



 

你可能感兴趣的:(Python,python)