Python Forum
I can't print what I need and I can't figure it out **wall**
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I can't print what I need and I can't figure it out **wall**
#1
Sad 
This is my code.
dasy_of_vaycay = int(input())
budget = float(input())
people = int(input())
gas_from_100 = float(input())
money_to_eat_per_day = float(input())
money_for_rent = float(input())
distance_day1 = int(input())
distance_day2 = int(input())
distance_day3 = int(input())
distance_day4 = int(input())
distance_day5 = int(input())
distance_day6 = int(input())
distance_day7 = int(input())

total_money_for_rent = 0
total_money_to_eat = 0
diff = 0
current_expenses = 0

if people > 10:
    money_for_rent = money_for_rent * people * 0.75
    total_money_for_rent = money_for_rent * 0.25
elif people < 10:
    total_money_for_rent = money_for_rent * dasy_of_vaycay
    total_money_to_eat = money_to_eat_per_day * dasy_of_vaycay * people
    current_expenses = total_money_to_eat + total_money_for_rent

for i in range(dasy_of_vaycay + 1):
    if current_expenses > budget:
        diff = current_expenses - budget * (-1)
        print(f'Not enough money to continue the trip. You need {diff}$ more.')
        break
    elif gas_from_100:
        total_gas_day1 = gas_from_100 * distance_day1
        total_gas_day2 = gas_from_100 * distance_day2
        total_gas_day3 = gas_from_100 * distance_day3
        total_gas_day4 = gas_from_100 * distance_day4
        total_gas_day5 = gas_from_100 * distance_day5
        total_gas_day6 = gas_from_100 * distance_day6
        total_gas_day7 = gas_from_100 * distance_day7
        total_gas_from_100 = total_gas_day1 + total_gas_day2 + total_gas_day3 + total_gas_day4 + total_gas_day5 /\
        + total_gas_day6 + total_gas_day7
        current_expenses += total_gas_from_100
    if i == 3 or 5:
        current_expenses = current_expenses * 0.4
    elif i == 7:
        current_expenses = current_expenses / people
        diff = current_expenses - budget * (-1)
        print(f'You have reached the destination. You have {diff}$ budget left.')
    else:
        print(f'Not enough money to continue the trip. You need {diff}$ more.')
This is my task.
https://ibb.co/SfXZKWd
buran write Mar-06-2021, 11:14 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply


Messages In This Thread
I can't print what I need and I can't figure it out **wall** - by icedragon978 - Mar-06-2021, 10:40 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020