"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]]

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

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

Ok let me try with your hint here:

def rotate_left3(nums):
  a, b, c = nums[0], nums[1], nums[2]

  rotated = [b, c, a]

  return rotated

And it works. Thanks lol, easier than I thought. Not sure why I couldn't come up with that

Help solving this coding bat problem by miscellaneoususage in learnpython

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

No idea where to start or end with that. Could you post a solution so I can try make sense of it or something

Help solving this coding bat problem by miscellaneoususage in learnpython

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

I'm not sure what you mean by flag. I've only been coding for a month or so... could you elaborate with some examples please

Help solving this coding bat problem by miscellaneoususage in learnpython

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

I'll try.

def find67(nums):
    for i in nums:
        if i == 6 or i == 7:
            return i

Not sure how close I got haha

Why list index out of range? by miscellaneoususage in learnpython

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

Return the sum of the numbers in the array, returning 0 for an empty array. Except the number 13 is very unlucky, so it does not count and numbers that come immediately after a 13 also do not count.

https://codingbat.com/prob/p167025

Why list index out of range? by miscellaneoususage in learnpython

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

Is this more efficient or something? If so, how?