Λύσεις_Προγραμματισμού_2017_0_Θέμα_Γ

# by tasos_chatz
# Μία λύση λίγο διαφορετική από τις συνηθισμένες
member = [70, 40, 25]
non_member = [80, 50, 30]
count = [0, 0, 0]
money = [0, 0, 0]
members = non_members = 0
vehicle = raw_input("Give vehicle type=")
while vehicle != "TELOS":
    melos = raw_input("Are you a member=")
    if melos == "Y":
        prices = member
        members += 1
    else:
        prices = non_member
        non_members += 1

    if vehicle =="F":
        index = 0
    elif vehicle == "E":
        index = 1
    else:
        index = 2        
    price = prices[index]
    money[index] += price
    count[index] += 1
    vehicle = raw_input("Give vehicle type=")

print "Trucks ", count[0], money[0]
print "Cars ", count[1], money[1]
print "Moto ", count[2], money[2]

print "Total Vehicles=", count[0] + count[1] + count[2]
print "Total Money=", money[0] + money[1] + money[2]
print "Members=", members
print "Non members=", non_members
Δημοσιεύθηκε στην ΛΥΣΕΙΣ_ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ_Python. Αποθηκεύστε τον μόνιμο σύνδεσμο.

Αφήστε μια απάντηση