Hot answers tagged

2

except for the first element, which is supposed to have no operation, but I gave it an Operation.SUBSTITUTED And this is probably the problem, since that operation subtracts 1 from i and j, which means when matrix[0][0] is dealt with, i and j both get set to -1, which will be out of range. Perhaps you should be using None instead of Substituted for the ...


2

Ahh I figured it out! Instead of using ~/pset1/hello/ $ go back to just the directory pset by using change directory ~/pset1/hello/ $ cd ~/pset1/ then add your ls command ~/pset1/ $ ls hello/ hello.c then compile ~/pset1/ $ clang hello.c adds the machine code to your directory and then you can execute! My only questions now is about the hello/ . ...


1

passengers is a list of Passenger objects, therefore print(self.passengers) is printing a list of Passenger objects. This print(self.passengers.flight_id) would fail because self.passengers is a list and the list has no flight_id attribute. Program needs to iterate through passengers list to get the attributes (e.g. flight_id, name) of each Passenger object. ...


1

Solution {% for stock in stocks %} <tr> <td> {{ stock.symbol }} </td> <td> {{ stock.name }} </td> <td> {{ stock.quantity }} </td> <td> {{ stock.price }} </td> </tr> {% endfor %}


1

It's because when you run an SQL query with execute(), all the affected records in the database are returned to you, in an array of dictionaries. So you want the first dictionary in that list. But if you gave for example a query that returns all users whose name starts with an S, you might want to use the whole array. Hope that helps. Also from the doc on ...


1

Some of the "Shorts" in Week 0 and Week 1 dip a little into this (not much!) but they do provide a little insight into where you can go and do further research to find out the answers you may be looking for. Particularly, you can view the manual pages for whatever you are looking for in c. For example if you want to see the man page for the function printf, ...


1

I am confused as to why these are both called n. As a result, the line of the search function Why are they both n? Well, they could have been called anything he wanted. This was just for demonstration purposes (no time to think about names). aren't these two n's two different things? Yes, they are different variables. And what he's basically doing here is ...


1

It's common to use the variable n when we are talking about numbers. That example also help you to realize that even when those data are receiving the same variable name, they won't collide because they have different scopes (you have to check inside the ptr node to compare if the value n inside it is equal to the value n in main.


Only top voted, non community-wiki answers of a minimum length are eligible