i dont even know where to start in this one lol .......

write a program to calculate and print the total parking
charges for a customer at a long term parking lot. The charges are calculated according to the number of days parked at the lot. The parking charges for the first 15 days of are \$10
per day. After that, the charges are \$6 per day.

should i use a if statement? while loop? for loop? or does it even matter?

how do i make python calculate the dates ..heres wha i started wit and got stuck

``````def parking_charges(entermonth, enterday, exitmonth, exitday):
if exitday - enterday == 15:

now that works correctly if i put in the right date.... example:
parking_charges(10, 1, 10, 16)
but if i do anything else its wrong .. i think u have to do sumthing with entermonth and exit month to correctly calculate but i dont understand ...

my teacher is no help ... shes one of those who knows it and thinks we already know it ...but we are at entry level so we really dont know anything Lol ...please help

1
Contributor
1
3
Views
7 Years
Discussion Span
Last Post by MichelleCrews

is there n e way to short this??

``````if entermonth == 1:
day = enterday

elif entermonth == 2:
day = enterday + 31

elif entermonth == 3:
day = enterday + 59

elif entermonth == 4:
day = enterday + 90

elif entermonth == 5:
day = enterday + 120

elif entermonth == 6:
day = enterday + 151

elif entermonth == 7:
day = enterday + 181

elif entermonth == 8:
day = enterday + 212

elif entermonth == 9:
day = enterday + 243

elif entermonth == 10:
day = enterday + 273

elif entermonth == 11:
day = enterday + 304

elif entermonth == 12:
day = enterday + 334

else:
day = 365 - enterday

Calculating Exit Day

if exitmonth == 1:
leaveday = exitday

elif exitmonth == 2:
leaveday = exitday + 31

elif exitmonth == 3:
leaveday = exitday + 59

elif exitmonth == 4:
leaveday = exitday + 90

elif exitmonth == 5:
leaveday = exitday + 120

elif exitmonth == 6:
leaveday = exitday + 151

elif exitmonth == 7:
leaveday = exitday + 181

elif exitmonth == 8:
leaveday = exitday + 212

elif exitmonth == 9:
leaveday = exitday + 243

elif exitmonth == 10:
leaveday = exitday + 273

elif exitmonth == 11:
leaveday = exitday + 304

elif exitmonth == 12:
leaveday = exitday + 334

else:
leaveday = 365 - exitday``````
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.