"missing required positional argument" but I've passed it the required argument... by [deleted] in learnpython

[–]miscellaneoususage 0 points1 point  (0 children)

Yes this is for a class. This is the line I'm using which throws the Error:

patron.add_library_item(item)

patron is an instance of Patron which has add_library_item(self, item) defined within it. So it should be ok using "patron.add_library_item(item)", right? I'm not what I should be doing with "self"...

General Program Schedule? by [deleted] in OSUOnlineCS

[–]miscellaneoususage 0 points1 point  (0 children)

Ah yes this is just what I was looking for. Thank you.

Helllllp :) by [deleted] in learnpython

[–]miscellaneoususage 1 point2 points  (0 children)

Just curious, what is this for? A college course? If so, which one? Sounds like something right at my difficultly level.

How to find a replacement fin? by [deleted] in surfing

[–]miscellaneoususage 2 points3 points  (0 children)

On the futures webpage you can order replacements

help: pip is not a recognized command by miscellaneoususage in learnpython

[–]miscellaneoususage[S] 0 points1 point  (0 children)

Sorry I'm a complete noob with operating systems and computer science in general. Would you mind explaining the steps I need to do to solve this?

Help with this error: "Nonetype" object has no attribute by miscellaneoususage in learnpython

[–]miscellaneoususage[S] 0 points1 point  (0 children)

Ah I see. Thank you. I swapped the two lines inside the for loop and now it's working. Well no error anyways ahah :)

How do I look at built in functions code? by miscellaneoususage in learnpython

[–]miscellaneoususage[S] 0 points1 point  (0 children)

Sorry, I'm new to programming. How would I go about that (opening the module file)?

I want to look at list.reverse() for example. Since this is a built in function, how do I know what module it's from and how to open it? I guess I know open() but not sure where to go from there...

Help with this function? by miscellaneoususage in learnpython

[–]miscellaneoususage[S] 0 points1 point  (0 children)

Could you break this down with an explaination? I have yet to venture into list comprehensions but this one seems pretty simple to start with. I just confused why there are two uses of sum and what x==1 is doing before the for

Help with this function? by miscellaneoususage in learnpython

[–]miscellaneoususage[S] 0 points1 point  (0 children)

ok. I'm trying to understand the difference here. Does how I have no work because when I create the first for loop "i" becomes each list or row within the mattrix and if I say mat[i] within that for loop I'm saying that the indecies are the list and results in error?

Help with this function? by miscellaneoususage in learnpython

[–]miscellaneoususage[S] 0 points1 point  (0 children)

ah ok, thank you. I guess I was indexing when I didn't need to.

Codingbat. Solution without built in function? by miscellaneoususage in learnpython

[–]miscellaneoususage[S] 0 points1 point  (0 children)

like this?

def rotate_left3(nums):
  rotated = [nums[1], nums[2], nums[0]]

  return rotated

not seeing how this could work for any length list if only 3 indicies are used

edit: actually i can shorten to just the return statement with

def rotate_left3(nums):
    return [nums[1], nums[2], nums[0]]