Homework 5.3: Note: it is okay if your procedure produces an error if the input hexamester is not included in courses.

Why?? I showed my code throws an error if the input hexamester is not included in courses and my code was considered wrong!!! It's unfair!!! I removed the example "print is_offered(courses, 'cs003', 'dec2012')" at the end of my page and my exercise is correct!! I don't want complain of automatic corrections, but I'm a bit vexed!!

My solution:

def is_offered(courses, course, hexamester):
    clist = courses_offered(courses, hexamester)
    if course in clist:
        return True
    return False

asked 28 Mar '12, 04:15

shilaghae's gravatar image

shilaghae
216
accept rate: 50%

edited 28 Mar '12, 04:15


3 Answers:
link

answered 28 Mar '12, 05:15

Clair%20Dunn's gravatar image

Clair Dunn
5.1k175697

My code works exactly like yours and it was graded correctly. Judging from the other posts, I guess there was a bug in the grading script.

My submission was:
def is_offered(courses, course, hexamester):
return course in courses_offered(courses, hexamester)

link

answered 28 Mar '12, 05:31

shebaw's gravatar image

shebaw
1.1k31125

I know what is the problem, at the end of my page I'm used to writing some examples, as follow:

print courses_offered(courses, 'apr2012')
print is_offered(courses, 'cs101', 'apr2012')
print is_offered(courses, 'cs003', 'apr2012')
print is_offered(courses, 'cs003', 'dec2012')

The last one only to demonstrate that the code throws an error when it is runned, (how the Node required). Removing the last example and pushing "submit" again, my answer is considered correct!!
For this reason I'm saying that the automatic correction is unfair!!

link
This answer is marked "community wiki".

answered 28 Mar '12, 05:45

shilaghae's gravatar image

shilaghae
216

Your answer
Question text:

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×15,283
×1,718
×24
×6
×2

Asked: 28 Mar '12, 04:15

Seen: 143 times

Last updated: 28 Mar '12, 05:45