# I roughly copied the source you made.
# int(input()) is omitted.
# 15 years or 15 minutes. If you're confused... I'll change it to the 27th.
# If you're still confused, that's a bit of a problem.
minutes = 38880
# Minutes is greater than 30.
# If you look at the code below, it feels like "extra charge" should come out.
if minutes < 15 :
print("FREE OF CHARGE")
elif minutes > 15 :
print("$20")
elif minutes > 30 :
print("extra charge")
# Do you think so?
# Try it by pressing the Run in the lower right corner button. ↘
You succeeded in dividing the section with an inequality... According to the code you gave, if you park for more than 15 minutes, the fare will always be 3,000 won, whether you park for 15 minutes or 15 years.
In general, else if
fails with all of the (else)if
conditions in front of it, and if the conditions succeed, it executes the magnetic block code and then escapes the entire conditional statement to which it belongs. (If the magnetic condition fails, the next condition is passed.) So for example, if you parked for 15 years (=7889238
), Parking time <15
is false
but Parking time > 15
is 3000 so it ends. Wow! That's a lot!
I'll give you a few more hints and finish my turn.
© 2024 OneMinuteCode. All rights reserved.