# I'm having trouble with this Python question..Need help please!

I’m currently learning Python, and stuck with this question below.
Below after the lines are different values used in my code. And there are some issues… I’ve spent too much time on this and still can’t find the right answer. Can someone please help me with question?

``````car_value = 10000
purchase_year = 2011
car_age = 8
driver_age = 23
electric = True
emissions_passed = True
``````

#You’re writing some code to determine how much it will cost
#to renew the tag on your license plate. Why? Because I just
#had to pay my tag renewal, and if I have to deal with this
#mess, so do you.

#Georgia’s tag renewal policies are unnecessarily
#complicated. I’ve simplified them to make this problem even
#doable. They are:

# - Everyone pays \$20.
# - If you purchased your car before 2013 (in 2012 or earlier),
# you also pay 1% of its current value in additional tax.
# - If the car is electric, you pay an additional \$200 fee.
# (This is real.)
# - To renew, you must have passed an annual emissions check,
# unless your car is electric, or if you’re 65 or over and
# the car’s age is 10 years or older.

#Your code should print one of two messages. If the person
#needs to pass an emissions test in order to renew their tag,
#it should print, “You must pass an emissions test first.”
#This would be the message to print if emissions_passed is
#False and if they are not eligible for either exemption
#mentioned above.

#If the person is eligible to renew their tag, the code should
#print: “Your renewal fee is \$__.”, where __ is the renewal
#cost. Round the renewal fee to the nearest integer. This will
#be \$20, plus \$200 if the car is electric, plus 1% of car_value
#if the purchase_year is less than or equal to 2012.

``````car_value_percentage = int(car_value * 0.01)

if emissions_passed == True:
if purchase_year <= 2012:
if electric:
print("Your renewal fee is \$" + str(200 + 20 + car_value_percentage) + ".")
elif not electric:
print("Your renewal fee is \$" + str(20 + car_value_percentage) + ".")
elif purchase_year >= 2012 and electric:
print("Your renewal fee is \$" + str(20 + 200) + ".")
elif purchase_year >= 2012 and not electric:
print("Your renewal fee is \$" + str(20) + ".")
if emissions_passed == False and (not electric and car_age >= 10 or driver_age >= 65):
print("You must pass an emissions test first.")
else:
if emissions_passed == False:
if purchase_year <= 2012:
if electric:
print("Your renewal fee is \$" + str(200 + 20 + car_value_percentage) + ".")
elif not electric:
print("Your renewal fee is \$" + str(20 + car_value_percentage) + ".")
elif purchase_year >= 2012 and electric:
print("Your renewal fee is \$" + str(20 + 200) + ".")
elif purchase_year >= 2012 and not electric:
print("Your renewal fee is \$" + str(20) + ".")
``````

We found the following problems with your submission:

We tested your code with car_value = 30000, purchase_year = 2015, car_age = 12, driver_age = 68, electric = False, emissions_passed = False. We expected your code to print this:

However, it printed this:

You must pass an emissions test first.

We tested your code with car_value = 50000, purchase_year = 2009, car_age = 11, driver_age = 98, electric = False, emissions_passed = False. We expected your code to print this:

However, it printed this:

You must pass an emissions test first.

We tested your code with car_value = 50000, purchase_year = 2017, car_age = 7, driver_age = 86, electric = True, emissions_passed = False. We expected your code to print this:

However, it printed this:

You must pass an emissions test first.

We tested your code with car_value = 30000, purchase_year = 2010, car_age = 8, driver_age = 28, electric = False, emissions_passed = False. We expected your code to print this:

You must pass an emissions test first.

However, it printed this:

Note that these errors may have prevented us from checking your submission in other ways, so fixing these problems may cause other problems to show up next time. Keep trying! This is what debugging is all about.

We tested your code with car_value = 10000, purchase_year = 2011, car_age = 8, driver_age = 23, electric = True, emissions_passed = True. We expected your code to print this, and it did:

We tested your code with car_value = 30000, purchase_year = 2018, car_age = 2, driver_age = 32, electric = True, emissions_passed = False. We expected your code to print this, and it did:

We tested your code with car_value = 30000, purchase_year = 2015, car_age = 8, driver_age = 68, electric = False, emissions_passed = False. We expected your code to print this, and it did:

You must pass an emissions test first.

We tested your code with car_value = 30000, purchase_year = 2015, car_age = 12, driver_age = 51, electric = False, emissions_passed = False. We expected your code to print this, and it did:

You must pass an emissions test first.

We tested your code with car_value = 10000, purchase_year = 2004, car_age = 19, driver_age = 56, electric = True, emissions_passed = False. We expected your code to print this, and it did:

We tested your code with car_value = 20000, purchase_year = 2010, car_age = 2, driver_age = 92, electric = False, emissions_passed = False. We expected your code to print this, and it did:

You must pass an emissions test first.

We tested your code with car_value = 20000, purchase_year = 2017, car_age = 13, driver_age = 20, electric = False, emissions_passed = False. We expected your code to print this, and it did:

You must pass an emissions test first.

We tested your code with car_value = 10000, purchase_year = 2015, car_age = 1, driver_age = 98, electric = False, emissions_passed = True. We expected your code to print this, and it did: