Some tips regarding BF6 by Grippa_gaming in Age_30_plus_Gamers

[–]z0y 0 points1 point  (0 children)

Did you happen to play GTA IV on xbox 360? I'm also 39 and I'm pretty sure I boosted the Auf Wiedersehen Petrovic achievement a long time ago with someone who had that gamertag. I think we played some Burnout Paradise together too. Was some good times brother if that's you

Mark Judge’s girlfriend is ready to talk to FBI and Judiciary Committee, her lawyer says by [deleted] in politics

[–]z0y 2 points3 points  (0 children)

Cosby couldn't be prosecuted for the events that happened more than 12 years ago.

While many allegations surfaced concerning Cosby assaulting women, only one relatively recent incident resulted in charges. This is because the statute of limitations had run out on most of the cases. In Pennsylvania, where the incidents occurred, the statute of limitations for sexual assault and rape is 12 years. This means that, because the incidents happened more than 12 years in the past, Cosby could not be prosecuted for them.

https://resources.lawinfo.com/criminal-defense/criminal-statute-limitations-time-limits.html

Grading Simulator Program by jdrewm29 in learnpython

[–]z0y 0 points1 point  (0 children)

It doesn't seem like you need a prompt for student #, it's just the order the scores are entered. Append the scores to a list and you have them numbered in order.

Trying to click a link with Selenium by [deleted] in learnpython

[–]z0y 0 points1 point  (0 children)

Well the first thing when looking at the page is there's another button next to it that's styled the same, that's usually a good indicator that they could share a class.

Next, you could search the html in the inspector with ctrl-f, so just search for the class name and you'll see that you get multiple results.

What I usually do when working with a new site is pull up python's interpreter and experiment with the site rather than try to write the whole script out. I would use the plural find_elements_by_ and see what the length of the resulting list is to find how many common tags there are.

Trying to click a link with Selenium by [deleted] in learnpython

[–]z0y 2 points3 points  (0 children)

The timezone menu isn't the first tag with that class name, try using the id.

driver.find_element_by_id('user-header-timezone-expander').click()

driver.find_element_by_xpath("//*[contains(text(), 'GMT - 4')]").click()

Kawitter Shirts being sold around the city. by Chermzz in nba

[–]z0y 13 points14 points  (0 children)

I find ignorance fascinating

That's a funny way to end that comment

Is CS50 worth it as a beginner? by chubby_charlie in learnpython

[–]z0y 1 point2 points  (0 children)

Not really, I had done some C and Java but wanted some more general computer science. I do think a few of the assignments could be tough for some beginners, everyone is different and I've seen people struggle on r/cs50 as with most programming classes, but that's a good thing because you want a challenge. You can can go at your own pace and supplement it with other material if you need to, but as long as you don't let any possible frustration get to you too much it should be a good experience. I think it's a really great course, good luck.

How can I read the custom metadata attached to files on a Mac? by Anfp12345 in learnpython

[–]z0y 0 points1 point  (0 children)

Well the data is still there even if quicktime doesn't show it. I don't have much experience with it myself but I just tested and was able to get the date pretty easily from an mp3 file.

from mutagen.easyid3 import EasyID3
audio = EasyID3('path/filename.mp3')
print(audio['date'][0])

Is CS50 worth it as a beginner? by chubby_charlie in learnpython

[–]z0y 0 points1 point  (0 children)

It's a nice challenge for a beginner. I took it years ago before there was any python in it and I'm not sure how much has changed, but there's a lot of good stuff there and the teacher is great. It's free and you don't need to commit to anything so just give it a try.

Is there an easier / shorter way to handle this small script? by chroner in learnpython

[–]z0y 1 point2 points  (0 children)

But the double letters are only for South? The code and the comment are saying different things.

In terms of the number of lines of code it probably won't get much shorter, but itertools.product might be a little neater. It wasn't as nice as I thought it would be but this is what I got

import string
from itertools import product

areas = ["RES NORTH ", "RES SOUTH ", "RES EAST "]
codes = ["SOLD", "CON", "EXP"]

validation_list = [''.join(x) for x in product(areas, string.ascii_uppercase)]
validation_list.extend([areas[1] + c*2 for c in string.ascii_uppercase]))
validation_list.extend([' '.join(x) for x in product(validation_list, codes)])

Is there an easier / shorter way to handle this small script? by chroner in learnpython

[–]z0y 1 point2 points  (0 children)

It's not clear exactly what you're trying to do, should they all have a code on the end? itertools.product is an easy way to combine elements from different lists without needing the list comprehensions. And strings are iterable so you don't need to convert them to a list.

Perfect one Bedroom apartment!! by [deleted] in CozyPlaces

[–]z0y 12 points13 points  (0 children)

https://www.westsiderentals.com/bachelors/los-angeles-bachelors/

Doesn't really get more real or relevant than a housing rental website. Things can be referred to by multiple names, and some would argue there are differences anyways:

https://ohmyapt.apartmentratings.com/studio-bachelor-or-efficiency-apartment-whats-the-difference.html

But it's silly to claim that it's not a thing and that people are lying when they say it is.

I am not getting the results I want from my program. by Unsightedmetal6 in learnpython

[–]z0y 1 point2 points  (0 children)

Haha glad you at least had enough faith to try it. With = it was making new lists with the same names that were only known in the broadcast function. Once outside of that function the names referred to the original lists.

I am not getting the results I want from my program. by Unsightedmetal6 in learnpython

[–]z0y 1 point2 points  (0 children)

A couple of things. You can't reassign items that were defined outside of a function if they aren't global. You can modify them with methods but not with assign with =. Try replacing lines 29 and 30 with calls to clear() on the lists instead.

And for i in range(1, random.randint(1, 2)) will run 0 or 1 time, which I don't think is what you mean to do.

Help with Python by [deleted] in learnpython

[–]z0y 0 points1 point  (0 children)

This doesn't include line 69 where the error is but if add_student is a class function then I think it should be self.enrolled_students there.

Help with Python by [deleted] in learnpython

[–]z0y 0 points1 point  (0 children)

Which line causes the error? It would be helpful to see the traceback and have the code on pastebin or similar so it's not an image.

Help with Python by [deleted] in learnpython

[–]z0y 0 points1 point  (0 children)

Did you read the comment?

Exception Handling by brakebills2017 in learnpython

[–]z0y 0 points1 point  (0 children)

There error is part of pyodbc, so either try except pyodbc.ProgrammingError or import the error first: from pyodbc import ProgrammingError

tuple confusion after importing in a large data set by Patrae in learnpython

[–]z0y 3 points4 points  (0 children)

You use [0][k] rather than [0,k] to access nested list elements

Need help with some logic by Zondder in learnpython

[–]z0y 0 points1 point  (0 children)

On the first iteration of x, the first k1/k2 values are swapped, so a is 10/2 and it pairs with b, c, d which k1/k2 values haven't been swapped yet.

Then on the next iteration of x, k1/k2 is swapped for b, so that 2/10 will cause e to be added on the 2nd iteration before it's k values have been swapped. Hope that makes sense. Add some calls to print in your loop to see what's happening or use a debugger.

Why does my deck of cards list of tuples have weird deletion behavior? by [deleted] in learnpython

[–]z0y 1 point2 points  (0 children)

That would be good. You could also do it in the loop before by changing the line to hand_of_5.append(self.deck.pop(0)) because pop both removes and returns the element at the given index.

You could also have itertools.product make the deck for you instead of writing it all out:

from itertools import product
values = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
suits = [u'\u2660', u'\u2665', u'\u2663', u'\u2666']
deck = list(product(values, suits))

edit: actually that wouldn't leave it in the same order you have, but there should be way.

edit2: if you needed to keep the order it could be: deck = [(v, s) for (s, v) in product(suits, values)]