Jun-25-2020, 05:50 AM
Essentially, the script is to take soccer teams (15 players per team) and calculate the cheapest carts to rent
big cart carry's 48 people costs $200 per cart
small cart carries 10 and costs $95.
So 1 team will = 2 small carts costing $190
2 teams will = 1 big cart costs $200 (same for 3 teams)
so on and so forth. My current script doesn't particularly function when doing more than 1 team it just keeps adding small carts. I know the issue is probably within the loop but I am unsure where exactly its going awol.
big cart carry's 48 people costs $200 per cart
small cart carries 10 and costs $95.
So 1 team will = 2 small carts costing $190
2 teams will = 1 big cart costs $200 (same for 3 teams)
so on and so forth. My current script doesn't particularly function when doing more than 1 team it just keeps adding small carts. I know the issue is probably within the loop but I am unsure where exactly its going awol.
socTeam = int(input("How many teams?")) socTeamPlayer = socTeam * 15 bigCart = 0 smallCart = 0 while socTeamPlayer > 0: if socTeamPlayer / 48 > 1: socTeamPlayer -= 48 bigCart += 1 else: socTeamPlayer -= 10 smallCart += 1 cost = (bigCart * 200) + (smallCart * 95) print("Hire", bigCart, "big Carts and", smallCart, "small Carts.") print("Cost =", cost)