I received my mark for the term test #2 today and I did a lot better than I expected.
The score was an improvement from the term test #1 which makes me satisfied.
After the first term test, I understood what the test format and questions are like which is why I managed to score better on the second one.
Now that the two tests are over and only have one quiz left in the course, there will be final exam to prepare for.
I expect the format to be like the quizzes and the tests so hopefully I can do well on the final as well.
While I was preparing for my final quiz of the course, I ran into some difficulty on DrRacket coding.
In tutorial #9 handout, we were told to fix the definition in spiral.rkt. All other parts I was able to make the correction. Nevertheless, I couldn't pass the tests for the part below.
; make-palindrome : string -> string
; Produce palindrome from s
(check-expect (make-palindrome "a") "a")
(check-expect (make-palindrome "ab")
(string-append
(substring "ab" 0 1)
(make-palindrome (substring "ab" 1))
(substring "ab" 0 1)))
(check-expect (make-palindrome "Danny")
(string-append
(substring "Danny" 0 1)
(make-palindrome (substring "Danny" 1))
(substring "Danny" 0 1)))
;
(define (make-palindrome s)
(cond
[(equal? (string-length s) 1) s]
[else
(string-append
(substring s 0 1)
(make-palindrome (substring s 1))
(substring s 0 1))]))
I had to ask the TA at the tutorial just now to figure out the correct answer for this definition.
Before then, I was stuck for a while and wrote something like this.
(define (make-palindrome s)
(cond
[(equal? s "a") s]
[else
(string-append
(substring s 0 1)
(make-palindrome (substring s 1))
(substring s 0 1))]))
This, for obvious reason, did not pass the test.
Now that the TA explained to me how it works, I understood why the above is not correct answer.
We will see how I do on my last quiz of the course!
Hey,I had the same mistakes before!
ReplyDeletereally? haha I guess you've managed to fix your mistake as well.
ReplyDeleteGood luck!