Python Forum
Autograder keeps kicking back my code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Autograder keeps kicking back my code
#1
Just started learning to code python. On my second lab and I'm not sure what I'm doing wrong. We have to put our code into the autograder, and it gives us back our grade, we can submit as many times as we want. We are also given an instruction sheet with the input and output names. The autograder is really strict with grading and will give you a zero for the smallest mistake. I've included what I have written and the kickback from the grader. When I run the program normally, it works completely fine with no issues. If anybody has any clue, please let me know. If you need more context on the assignment, I am happy to give it.

Attached Files

Thumbnail(s)
   

.txt   Lab.txt (Size: 1.26 KB / Downloads: 106)
Reply
#2
Next time post code instead of attaching text file. You should also post the instructions. I assume there is a 7% delivery charge, a 15% discount on pizza orders > 15 pizzas, and a 15% discount on salad orders > 10 salads. At least that is what your code says. Seems like there would be a discount of 15% on 10 items or more, but that is not what your code does. And should the delivery fee be calculated on the discounted or non-discounted cost.?

The feedback from the autograder does not match your program. I don't think the code you posted is the code that generated the feedback from the autograder. Nowhere does your program print the number of salads ordered. Nor does the output from the autograder match with the input (43 and 7 are input. Neither == 11).
Reply
#3
(Aug-24-2024, 02:31 AM)deanhystad Wrote: Next time post code instead of attaching text file. You should also post the instructions. I assume there is a 7% delivery charge, a 15% discount on pizza orders > 15 pizzas, and a 15% discount on salad orders > 10 salads. At least that is what your code says. Seems like there would be a discount of 15% on 10 items or more, but that is not what your code does. And should the delivery fee be calculated on the discounted or non-discounted cost.?

The feedback from the autograder does not match your program. I don't think the code you posted is the code that generated the feedback from the autograder. Nowhere does your program print the number of salads ordered. Nor does the output from the autograder match with the input (43 and 7 are input. Neither == 11).

Attached Files

Thumbnail(s)
       
Reply
#4
(Aug-24-2024, 02:31 AM)deanhystad Wrote: Next time post code instead of attaching text file. You should also post the instructions. I assume there is a 7% delivery charge, a 15% discount on pizza orders > 15 pizzas, and a 15% discount on salad orders > 10 salads. At least that is what your code says. Seems like there would be a discount of 15% on 10 items or more, but that is not what your code does. And should the delivery fee be calculated on the discounted or non-discounted cost.?

The feedback from the autograder does not match your program. I don't think the code you posted is the code that generated the feedback from the autograder. Nowhere does your program print the number of salads ordered. Nor does the output from the autograder match with the input (43 and 7 are input. Neither == 11).
This is the exact code that I put into the autograder.
# List inputs so user can enter values
p = float(input("Number of pizza orders "))

s = float(input("Number of salad orders "))

# Calculates pizza cost, salad cost, total cost of pizza and salad combined, delivery charge, total amount , and the discount.
pizza_cost: float = (p * 15.99)
salad_cost: float = (s * 7.99)
total_cost: float = (pizza_cost + salad_cost)
delivery_charge: float = (7 / 100 * total_cost)
discount: float = 0

# Both of these if statements allow the discount to be applied on orders over 10 pizzas. It updates the variable to an actual discount.
if p > 10:
    pizza_discount1: float = (15 / 100 * pizza_cost)
    discount += pizza_discount1

if s > 10:
    salad_discount1: float = (15 / 100 * salad_cost)
    discount += salad_discount1

# This if statement puts a minimum of $20 on delivery orders if 7% is under $20, and leaves it alone if delivery fee above $20.
if delivery_charge < 20:
    delivery_charge = 20

#Calculate total amount due
total_amount: float = (total_cost - discount + delivery_charge)

print("Ordered:",p)
print("Pizza cost $",pizza_cost)
print("Salad cost $",salad_cost)
print("Total $",total_cost)
print("Discount $",discount)
print("Delivery $",delivery_charge)
print("Total amount $",total_amount)
Gribouillis write Aug-24-2024, 05:50 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply
#5
You are not calculating the number of pizzas. A pizza order is for 3 slices, not an entire pizza. Each pizza has 12 slices. You need to add up the number of slices and divide by 12 and round up to get the number of pizzas
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Subtle Bug I really don't see in Autograder: Exercise 3.1 benante3 5 4,248 Dec-21-2020, 11:04 PM
Last Post: deanhystad
  A bug in my school's autograder DontPanic 1 2,145 Oct-14-2020, 09:04 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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