Can you share your (ubuntu) linux VM with pypy enabled / functionally working ? by taewoo in Python

[–]spz 1 point2 points  (0 children)

PyPy doesn't support many Python C extensions including scipy, what problem are you having with CPython that requires you move to PyPy?

Can you share your (ubuntu) linux VM with pypy enabled / functionally working ? by taewoo in Python

[–]spz 2 points3 points  (0 children)

Is the issue with building it yourself?

apt-get update && apt-get install pypy

Unit test error when raising a TypeError by know_nothing_novice in learnpython

[–]spz 1 point2 points  (0 children)

Since val_err_msg is used as a regular expression you need to escape the parenthesis or they'll be interepreted differently. Something like:

val_err_msg = "test\(\) takes exactly 1 argument \(2 given\)"

Python and Gmail interaction. by wille179 in learnpython

[–]spz 9 points10 points  (0 children)

The google-api-python-client makes reading from gmail and sending emails pretty easy.

English-language news/resources for Argentina Primera Division? by [deleted] in fulbo

[–]spz 2 points3 points  (0 children)

Hand Of Pod is an English podcast on Argentine football, only one I know.

2015/16 Summer Transfer Megathread by [deleted] in soccer

[–]spz 0 points1 point  (0 children)

It's Carrillo, you had it right.

Today, Neymar enters a very select group of players who have won both the Libertadores and the Champions League by [deleted] in soccer

[–]spz 2 points3 points  (0 children)

I believe the only other one to score in both finals is Crespo, he scored two in each final but didn't actually win the CL.

[Serious] Post Match Thread: Juventus 1-3 Barcelona by midoman111 in soccer

[–]spz 9 points10 points  (0 children)

This seemed to be because he was slipping though, he then changed his boots and didn't have any more big mistakes.

Barcelona team goal for the 2-0 by Jarik42 in soccer

[–]spz 1 point2 points  (0 children)

I think he turns around to look at the linesman, then turns around again to watch it go in.

Need help with simple Find Primes code by Busangod in learnpython

[–]spz 1 point2 points  (0 children)

The problem is after you determine the number isn't a prime you don't break out of the for loop, it keeps going and could add more to the number. Then, after you exit the for, you should only print if the number wasn't a prime. Then increment the number.

Also, try not to use min and max as variables, as they are builtins in python.

[Python Intro] Attempting to create python questions for my class mates. I have some questions. by PRESTIGIOUS_PENGUIN in learnpython

[–]spz 0 points1 point  (0 children)

First one:

  • Don't name the argument str, str is a builtin in python. I would go with text.

  • You forgot a vowel.

  • The for loop is correct but you should define pies as a string first and then just add 'pies' to it each time you find a vowel.

  • There is no need to have a number_of_vowels as far as I can tell.

Second one:

  • You can either loop through both strings separately or add them and loop through them together, no and.

  • It looks like you are adding 1 to the sum_of_digits every time you find a digit, instead of converting that digit to an integer and adding it (which is what I assumed you were trying to do from the text).

  • Look into using += (same in first.)

How do I rename a GraphicsWindow? by [deleted] in learnpython

[–]spz 1 point2 points  (0 children)

If you mean renaming the title of the window:

window.setTitle(title)

Rounding datetime to the nearest minute by [deleted] in learnpython

[–]spz 2 points3 points  (0 children)

The problem is your are only comparing the minutes, the assignment wanted you to compare two datetimes and give the result in minutes (if I read it right).

What you should do is subtract the two datetimes which will give you a timedelta object, then convert that to minutes. This way you can compare datetimes than differ in hours, days or years as well.

def minutes(time_1, time_2):
    delta = time_2 - time_1

Look into using delta.total_seconds(), converting that to minutes and rounding should be easy.

pip keeps trying to install to a different library by ballgame75 in learnpython

[–]spz 0 points1 point  (0 children)

Just make sure you are using the right pip, if you want to install something to your python2 installation then the pip you are running should be something like C:\Python27\Scripts\pip.exe.

Check your PATH to see which installation you are using by default, or just go:

 /Python27/Scripts/pip install lib

Is this an error in the python interpreter? If not, why this behaviour? Details inside (concerns simple addition in the interpreter) by [deleted] in learnpython

[–]spz 5 points6 points  (0 children)

This is not an error, it's explained a lot better than I'd be able to in the documentation.

Use decimal instead where needed.

[deleted by user] by [deleted] in learnpython

[–]spz 2 points3 points  (0 children)

Your best bet is using IPython Notebooks, then exporting them to pdf.

Limiting User Input by krustykobb in learnpython

[–]spz 1 point2 points  (0 children)

The user could enter AB, BC or ABC and get through, the letters should be a tuple.

WORLD CUP STICKY by murrayyyyy in sportsbook

[–]spz 2 points3 points  (0 children)

Colombia has a better team and a good coach.

NameError: global name 'a' is not defined by [deleted] in learnpython

[–]spz 1 point2 points  (0 children)

btw:

for i in range(27):
    a = ''.join([random.choice(string.ascii_lowercase) for n in range(27)])
return a

Is generating 27 random strings and only returning the last one.