There was no section for Assignment 3 questions so I am posting it here. When using the txt files of the books that are provided for assignment three, I get a UnicodeDecodeError. It says it can't decode certain bytes. "UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position". I assume this is because the txt files were encoded in another operating system, and I am using windows which encodes differently? How can I solve this?
I would be grateful if you would answer some questions regarding the midterm:
1.What is fair game for the game? Will there be questions on Tkinter?
2.Are there any passed exams we can use to study for the midterm? If not, are there any supplementary practice problems we can use to study?
3.How will the midterm be structured? (i.e. how many questions will there be? Will the questions be multiple choice and short answer? How many minutes will be given for the midterm?)
Earlier today I posted all of this information on this site and sent it by email through onQ as well. Please let me know if you are not able to access the information.
Thanks, Cowan_J, for posting the information about dealing with the encoding problem. I'm surprised to learn of this problem since the files were downloaded from Project Gutenburg.
Hi,
Since the exam is open book, does this allow us to access the course notes on this site during the exam? Does it also allow us to access the textbook during the exam?
Thanks,
Brendan Mahadeo
Hey all,
I noticed some odd results when testing the original exponent function for question 1 (i.e. 2^5 returns 64 and 2^6 returns 32). I had to make the recursive function in a different way because of this. I thought I'd post here in case people attempt to base their recursive function off the design of the original.
When rewriting the iterative functions to be recursive, is it considered correct as long as the recursive function has the same output as the iterative ones we are given?
Hi, for the Collatz sequence question in assignment 4, are we to write the better_collatz_up_to_n function so that it combines the collatz_up_to_n and collatz_rec functions, while also fixing the recursion in the collatz_rec function? Or are we to simply fix the collatz_rec function using the better_collatz_up_to_n function and use the collatz_up_to_n function to call better_collatz_up_to_n
Reply from R. Dawes: I don't really understand your question ... can you come to my office hours and we'll talk about it then?
I tried following the way to download matplotlib, and it won't let me, even with doing --prefer binary. It says I need a version newer than 14.0 for something from Microsoft C++ Build Tools, so I download it. Then, the same problem occurs when I try to install it again.
You could try using pip install matplotlib if you haven't already. That is what worked for me.
You can run it either in the terminal in your IDE or in the command line.
We need to make it so that if two restaurant/customer scores are equal, then sort them alphabetically. In my __lt__ functions I include a case where if the scores are equal, then return self.__name < other.__name. I checked that this executes and returns a true or false value, but when I use sorted() it does not change the two restaurant/customer position when this case happens.
Office Hours
Where can I find where we meet for office hours?
Office Hours
Office hours are online. The schedule (and link) are on the Personnel page.
Robin Dawes
Assignment 3 Txt files UnicodeDecodeError
There was no section for Assignment 3 questions so I am posting it here. When using the txt files of the books that are provided for assignment three, I get a UnicodeDecodeError. It says it can't decode certain bytes. "UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position". I assume this is because the txt files were encoded in another operating system, and I am using windows which encodes differently? How can I solve this?
Thank you.
Midterm
What will the midterm be on and are there any notes on how/what to study, and if so where?
Re: Assignment 3 Txt files UnicodeDecodeError
If you add encoding='utf8' into the open syntax you'll be able to alleviate the unicode error. ie:
f = open('Adventures_Sherlock_Holmes.txt', 'r', encoding='utf8')
Multiple people seem to be having this issue on Windows.
Assignment 3 Calculations
does anyone have the % similarity for any of the 2 books cuz I want to double-check my calculations
Midterm preparation
Hi Professor Dawes,
I would be grateful if you would answer some questions regarding the midterm:
1.What is fair game for the game? Will there be questions on Tkinter?
2.Are there any passed exams we can use to study for the midterm? If not, are there any supplementary practice problems we can use to study?
3.How will the midterm be structured? (i.e. how many questions will there be? Will the questions be multiple choice and short answer? How many minutes will be given for the midterm?)
Thank you for considering these questions.
Midterm preparation
Hi Dorothy
Earlier today I posted all of this information on this site and sent it by email through onQ as well. Please let me know if you are not able to access the information.
Robin Dawes
Encoding/Decoding the text files
Thanks, Cowan_J, for posting the information about dealing with the encoding problem. I'm surprised to learn of this problem since the files were downloaded from Project Gutenburg.
Open Book Exam
Hi,
Since the exam is open book, does this allow us to access the course notes on this site during the exam? Does it also allow us to access the textbook during the exam?
Thanks,
Brendan Mahadeo
Assignment 4
Hey all,
I noticed some odd results when testing the original exponent function for question 1 (i.e. 2^5 returns 64 and 2^6 returns 32). I had to make the recursive function in a different way because of this. I thought I'd post here in case people attempt to base their recursive function off the design of the original.
Assignment 4 exponent function
Hi, I just wanted to point out that the given non-recursive exponent function in assignment 4 does not actually work.
Reply from R. Dawes: Oops! I will provide a working version of the non-recursive function.
Assignment 4
When rewriting the iterative functions to be recursive, is it considered correct as long as the recursive function has the same output as the iterative ones we are given?
Reply from R. Dawes: Yes!
Assignment 4 Part II Collatz Sequence
Hi, for the Collatz sequence question in assignment 4, are we to write the better_collatz_up_to_n function so that it combines the collatz_up_to_n and collatz_rec functions, while also fixing the recursion in the collatz_rec function? Or are we to simply fix the collatz_rec function using the better_collatz_up_to_n function and use the collatz_up_to_n function to call better_collatz_up_to_n
Reply from R. Dawes: I don't really understand your question ... can you come to my office hours and we'll talk about it then?
Midterm Grades
Hi,
May I ask when we will get the grade of the midterm?
Assignment 4 Submission
Hi,
I was just trying to upload Assignment 4 to the onQ and noticed there is no where to do so.
Assignment 6
I tried following the way to download matplotlib, and it won't let me, even with doing --prefer binary. It says I need a version newer than 14.0 for something from Microsoft C++ Build Tools, so I download it. Then, the same problem occurs when I try to install it again.
Re: Assignment 6
You could try using pip install matplotlib if you haven't already. That is what worked for me.
You can run it either in the terminal in your IDE or in the command line.
Question about Assignment 7
For assignment 7, are we supposed to use a Numpy array for every list/array we create? Or just to import the data?
Question about assignment 7
I thought the assignment was due tonight at midnight, but I do not see where to post my work
Assignment 8: sorted() function comparison when scores are equal
We need to make it so that if two restaurant/customer scores are equal, then sort them alphabetically. In my __lt__ functions I include a case where if the scores are equal, then return self.__name < other.__name. I checked that this executes and returns a true or false value, but when I use sorted() it does not change the two restaurant/customer position when this case happens.
Re: Assignment 8: sorted() function comparison when scores are e
you would have to use self.name > other.name, when comparing strings, z > a but in this case you want a > z