General Questions or Comments

Submitted by Robin Dawes on Tue, 09/28/2021 - 12:01

Please post general questions or comments here

Office hours are online.  The schedule (and link) are on the Personnel page.

Robin Dawes

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.

What will the midterm be on and are there any notes on how/what to study, and if so where?

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.

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.

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

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.

Mahadeo_B

Sun, 10/17/2021 - 22:20

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.

Youngman_D

Mon, 10/25/2021 - 11:02

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.

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!

Mahadeo_B

Wed, 10/27/2021 - 14:16

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.

Mahadeo_B

Sun, 11/14/2021 - 14:55

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.

Mahadeo_B

Tue, 11/23/2021 - 15:58

For assignment 7, are we supposed to use a Numpy array for every list/array we create? Or just to import the data?

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.