In Csc148 Week2 we learnt about ADT’s: stacks and queues. I found them
to be simple and straight forward implementation of lists. One of my classmate has explained it well along with examples. This week we learnt about exceptions,
how to handle and trace them. But what I am still confused about is how to
raise them. Like, when we handle exceptions we write:
try :
;
;
except
ValueError:
print(“
; “)
So where do we write:
raise
ValueError(‘ ;’)
Do we write “raise” in the shell to check the working of the
program or we write it outside the class?
So, I googled for “raise“an exception and came across python tutorial . In section 8.4, it is clearly stated that “raise” is used to raise a certain
exception in the program. It is used in the body of the program (classes or
user defined exceptions) to re-raise a particular kind of exception (depending
upon the program type). Also it can be used in the shell if you want to check
whether your exception works according to your program or not.
So far I found csc148 to be simple yet tricky. Simple in the
sense it is easy to understand and implement with straightforward codes. But
tricky in the sense, that if I don’t practice the exceptions a couple of times
in the program, I would tend to forget it and it would be difficult to
understand it again.
I feel one of the draw backs in this course csc148 is to not
have a book assigned, since it gets tricky to find questions to practice
relating to the topic being discussed in the class as compare to csc108. I feel
one way to overcome this problem is to find some questions online and doing the
past test and exams. Also, I feel it would be nice if the professor could
upload some practice questions on the course website.
Exercise 1 was easy, interesting and engaging; but even then
I did some silly mistakes. I wish the correct code for the exercise was posted
on the course website so that I could cross check my own mistakes. For Lab 1 I
agree with my fellow student; it took me a while to figure out because it used dictionary and I am not
much comfortable using it. Lab 2 was easy, since it was based on stacks and queues
that uses list operations to define their respective classes. During the lab I
was asked to share and explain the code for queues. I felt confident enough to
go up in front of the class and share. Over all till date I find this course managable and i hope in the following weeks i will be able to say the same.