Question

In: Computer Science

Any amount of time less than or equal to one hour, the parking fee is 5.00....

  1. Any amount of time less than or equal to one hour, the parking fee is 5.00. This means if your parked for 5, 15, 55 or 60 minutes you pay $5.00

Minutes parked

Hrs*Fee=parking fee

25 minutes (0 hour and 25 minutes)

1*5.00

05 minutes (0 hour and 5 minutes)

1*5.00

55 minutes (0 hours and 55 minutes)

1*5.00

30 minutes (0 hour and 30 minutes)

1*5.00

10 minutes (0 hour and 10 minutes)

1*5.00

60 minutes (1 hour and 0 minutes)

1*5.00

  1. Any amount of time greater than one hour but less than or equal to 5 hours (300 minutes), the parking fee is 4.00 per hour and any fraction thereof. This means:

Minutes parked

Hrs*Fee=parking fee

65 minutes (1 hour and 5 minutes)

2*4.00

95 minutes (1 hour and 35 minutes)

2*4.00

120 minutes (2 hours)

2*4.00

135 minutes (2 hour and 15 minutes)

3*4.00

180 minutes (3 hour and 0 minutes)

3*4.00

195 minutes (3 hour and 15 minutes)

4*4.00

240 minutes (4 hours)

4*4.00

260 minutes (4 hours 20 minutes )

5*4.00

300 minutes (5 hours)

5*4.00

  1. Any amount of time greater than 5 hours, the parking fee is 2.00 per hour and any fraction.

Minutes parked

Hrs*Fee = parking fee

320 minutes (5 hour and 20 minutes)

6*2.00

400 minutes (6 hour and 40 minutes)

7*2.00

800 minutes (13 hour and 20 minutes)

14*2.00

825 minutes (13 hour and 45 minutes)

14*2.00

600 minutes (10 hours)

10*2.0

my work:

rate1=5
rate2=4
rate3=2
fees=0
minutes = int(input("Please Enter the number of minutes parked : "))
print(minutes)
if minutes>=0 and minutes<=60:
    if minutes%60==0:
        hrs=int(minutes/60)
        fees=hrs*rate1
        print("Parking Fees (in $) is ",fees )
    else:
        hrs=int(minutes/60)+1
        fees=hrs*rate1
        print("Parking Fees (in $) is ",fees )
elif minutes>60 and minutes<=300:
    print("It Falls in Table 2")
    if minutes%60==0:
        hrs=int(minutes/60)
        fees=hrs*rate2
        print("Parking Fees (in $) is ",fees )
    else:
        hrs=int(minutes/60)+1
        fees=hrs*rate2
        print("Parking Fees (in $) is ",fees )
elif minutes>300:
    print("It Falls in Table 3")
    if minutes%60==0:
        hrs=int(minutes/60)
        fees=hrs*rate3
        print("Parking Fees (in $) is ",fees )
    else:
        hrs=int(minutes/60)+1
        fees=hrs*rate3
        print("Parking Fees (in $) is ", fees)
    else:
    print("Invalid Minutes")

getting error line 36
else:
^
SyntaxError: invalid syntax    please help.

Solutions

Expert Solution

The error in the line 36 is nothing but the indentation error.

You wrote two else statements in the second elif condtition (i.e., elif minutes>300:) but actually it should be act as else statement for the first if condition (i.e., if minutes>=0 and minutes<=60:)

That's why it shown the syntax error.

I changed the code now it works perfectly

proof with output:

corrected code:

rate1=5
rate2=4
rate3=2
fees=0
minutes = int(input("Please Enter the number of minutes parked : "))
print(minutes)
if minutes>=0 and minutes<=60:
    if minutes%60==0:
        hrs=int(minutes/60)
        fees=hrs*rate1
        print("Parking Fees (in $) is ",fees )
    else:
        hrs=int(minutes/60)+1
        fees=hrs*rate1
        print("Parking Fees (in $) is ",fees )
elif minutes>60 and minutes<=300:
    print("It Falls in Table 2")
    if minutes%60==0:
        hrs=int(minutes/60)
        fees=hrs*rate2
        print("Parking Fees (in $) is ",fees )
    else:
        hrs=int(minutes/60)+1
        fees=hrs*rate2
        print("Parking Fees (in $) is ",fees )
elif minutes>300:
    print("It Falls in Table 3")
    if minutes%60==0:
        hrs=int(minutes/60)
        fees=hrs*rate3
        print("Parking Fees (in $) is ",fees )
    else:
        hrs=int(minutes/60)+1
        fees=hrs*rate3
        print("Parking Fees (in $) is ", fees)
else:
    print("Invalid Minutes")

***Please give a like if you are satisfied with the answer. If you have any doubts or you need any further information ask me through comments. THANK YOU! ***


Related Solutions

prove that 2/pi is less than or equal to (sinx)/x which is less than or equal...
prove that 2/pi is less than or equal to (sinx)/x which is less than or equal to 1. for x is in (0,pi/2]
A parking officer is conducting an analysis of the amount of time left on parking meters...
A parking officer is conducting an analysis of the amount of time left on parking meters after a motorist left a parking space. A quick survey of 15 cars that have left their metered parking spaces produced the following times (in minutes). Estimate with 95% and 80% confidence the mean amount of time left for all the vacant meters. Applying the correct Statistical Analysis. Show your results Estimated mean? Upper 95% Confidence limit. Lower 95% Confidence limit Which of the...
Prove that any amount of postage greater than or equal to 14 cents can be built...
Prove that any amount of postage greater than or equal to 14 cents can be built using only 3-cent and 8-cent stamps
For each of the following, fill in the blanks with "Less than", "Greater than", or "Equal...
For each of the following, fill in the blanks with "Less than", "Greater than", or "Equal to" *) A gas flows through a one-inlet, one-exit control volume operating at steady state with no internal irreversibilities, Qcv = 0. Heat transfer at a rate Qcv takes place only at a location on the boundary where the temperature is Tb. The specific entropy of the gas at the exit is _____ than the specific entropy of the gas at the inlet. *)...
A Parking Enforcement Officer in Adelaide is conducting an analysis on the amount of time left...
A Parking Enforcement Officer in Adelaide is conducting an analysis on the amount of time left on parking meters in the CBD. A quick survey of 14 metered parking spaces where cars had just left provided the following times (in minutes) 14 18 2 12 4 13 17 20 31 15 31 9 25 27 (a) What assumptions must you make to obtain a confidence interval for the mean amount of time left for all vacant meters? Calculated Mean: 16.2...
If we are testing the null hypothesis that the mean is less than or equal to...
If we are testing the null hypothesis that the mean is less than or equal to 100, and the critical value for the test is determined to be z = 1. 645, then the rejection region would be all of the z values that are ____________ 1. 645. Multiple Choice greater than less than greater than or equal to less than -1.645 or greater than +1.645
For each, indicate whether the first item is (greater than, equal to, less than) the second...
For each, indicate whether the first item is (greater than, equal to, less than) the second item oxygen content in the pulmonary veins      ___________       oxygen content in the carotid arteries Answer 1Choose...greater thanequal toless than maximum pressure in the aorta ___________     maximum pressure in the left atrium   Answer 2Choose...greater thanequal toless than blood flow through the lungs ____________ blood flow through the kidneys Answer 3Choose...greater thanequal toless than flow of blood through a dilated vessel _____________ flow of blood through...
solve tan^2 x =1 where x is more than or equal to 0 but x is less than or equal to pi
solev tan^2 x =1 where x is more than or equal to 0 but x is less than or equal to pi
8. The cardinality of S is less than or equal to the cardinality of T, i.e....
8. The cardinality of S is less than or equal to the cardinality of T, i.e. |S| ≤ |T| iff there is a one to one function from S to T. In this problem you’ll show that the ≤ relation is transitive i.e. |S| ≤ |T| and |T| ≤ |U| implies |S| ≤ |U|. a. Show that the composition of two one-to-one functions is one-to-one. This will be a very simple direct proof using the definition of one-to-one (twice). Assume...
4. Whether P3 or the space of the polynomials of degree less than or equal to...
4. Whether P3 or the space of the polynomials of degree less than or equal to 3 and consider T: P3 → P3, given by the derivation T(f) = f' . For example, T (−3x 2 + 5x - 10) = −6x + 5. (a) Prove that T is a linear transformation. (b) Determine ker (T). (c) Is the T transformation injective? Justify that. (d) The polynomial g (x) = 3x^2 + 1 belongs to the image? Justify that.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT