Originally Posted by Bostonian
class_grade = max(AP_exam_score,coursework_grade)

This is exactly how I got an A in AP history my junior year. I had a B on the basis of the ridiculous tests (because I refused to memorize what color everyone in the textbook illustrations was wearing, and similarly silly "facts" for quizzes). My parents were grumpy at me about the B until I brought home some quizzes to show them. They never said a word after that.

My high score on the test was due to my science/math background, too. We never discussed things like original sources or research, but I knew about them from my science courses and was able to sound like I knew what I was talking about in essays because of it.