# Python, beginner(logic building)

There are 100100 questions in a paper.

• Each question carries `+3` marks for correct answer,
• `-1` marks for incorrect answer i.e. one mark is deducted for each incorrect answer,
• `0` marks for an unattempted question.

It is given that Chef received exactly �X (0≤�≤100)(0≤X≤100) marks.
Determine the minimum number of problems Chef marked incorrect.

Hi I could only understand a bit from you help request I hope the below program of mine would help you with your problem.

``````def calculate_incorrect_marks(total_marks, received_marks):
return -1  # Invalid input, marks received exceed the maximum possible or negative

min_incorrect = total_marks  # Initialize minimum incorrect marks as the maximum possible

for incorrect in range(total_marks + 1):
correct = total_marks - incorrect
total_received_marks = correct * 3 - incorrect
min_incorrect = min(min_incorrect, incorrect)

if min_incorrect == total_marks:
return -1  # No combination of correct and incorrect marks results in the received marks

return min_incorrect

# Example usage:
total_questions = 100100