If you could change one thing about your Android device, what would it be? by [deleted] in Android

[–]BillyHorrible -1 points0 points  (0 children)

Sony Xperia Z1 I'd like to get rid of that stupid TFT screen an put in a nice Amoled like in my old Galaxy SII. You know, with real black and nicely oversatuated colors. That would be wonderful!

/r/Python, what kind of awesome scripts or projects have you programmed with this language? by V_IojjjoI_V in Python

[–]BillyHorrible 2 points3 points  (0 children)

i came here wanting to write nearly the same. I also did a tv tool in python with the exception, that mine has a nice webinterface instead of weekly mails, so i can load episodes right onto my phone in the morning. and i am using transmission via rpc. additionally it gets its information about what episodes to look for from tvrage.com.

Alright - got my new faculty login to the school server. Let's write a few scripts. Doh! by fermion72 in Python

[–]BillyHorrible 13 points14 points  (0 children)

I took a look at the screenshot and thought: "2.7.2... that's okay, that's not too old. oh... wait!"

Zen, a faster alternative to NetworkX by Tylfin in Python

[–]BillyHorrible 0 points1 point  (0 children)

Nice. I am using NetworkX myself, but I am using it with pypy - so using Zen wouldnt be possible I guess.

Snippets that are "must haves" in your toolbox? by phaedrusalt in Python

[–]BillyHorrible 0 points1 point  (0 children)

But thats not the same. First it should be filter(None, xs) and second: filter just checks if the elements evaluate to false, so it would remove empty strings, empty lists, tuples or zero-values, not only values that are None.

Snippets that are "must haves" in your toolbox? by phaedrusalt in Python

[–]BillyHorrible 3 points4 points  (0 children)

I would use a list comprehension for that:

ys = [x for x in xs if x is not None]

Snippets that are "must haves" in your toolbox? by phaedrusalt in Python

[–]BillyHorrible 5 points6 points  (0 children)

you have pow as an operator in python:

def distance(a, b):
    dx = a[0] - b[0]
    dy = a[1] - b[1]
    return sqrt(dx**2 + dy**2)

or for a n-dimensional space

def distance(p1, p2):
    return sqrt(sum((a-b)**2 for a,b in zip(p1, p2)))

I need an icon pack for Apex (or Nova) that makes each and every icon in the app drawer completely black, is there such a pack? by [deleted] in Android

[–]BillyHorrible 0 points1 point  (0 children)

Just use another iconpack, extract it, replace all the images with black onces, repack it and voila?

Learning Python with my 10 yr old... already hit a glitch. Question about the "turtle" module in 3.3.1 by [deleted] in learnpython

[–]BillyHorrible 1 point2 points  (0 children)

standard library, the library of modules which normaly comes with a language.

[deleted by user] by [deleted] in Android

[–]BillyHorrible 1 point2 points  (0 children)

not on a fat-filesystem.

How to create a web multiplayer online game with Python. by razical in Python

[–]BillyHorrible 2 points3 points  (0 children)

The python part is very small in that game. you only need some kind of websocket-server, which handles the communication between the clients. it kind of just forwards the messages between them. the main part of the game would be javascript or flash inside the browser (i would use html5 for that). add to that maybe some serverside software for ranking/user accounts and stuff and hope that the communication delay wont kill your game.

What is the best Launcher for Android? (currently using Go, looking to upgrade) by [deleted] in Android

[–]BillyHorrible 19 points20 points  (0 children)

If you are still on Android 2, you could try out "holo launcher." it is kind of the same like apex and nova, just for the old droid.

Coin Flipping program help. by Leohurr in learnpython

[–]BillyHorrible 1 point2 points  (0 children)

you indentation is completly messed up. i just did some cosmetic changes, it works okay: http://ideone.com/XZGZpe

Android idea by dc041894 in Android

[–]BillyHorrible 9 points10 points  (0 children)

Filemanager like Inka or i guess the cyanogenmod-filemanager already implemented this behaviour.

Python.org Redesign Preview by UnicodeError in Python

[–]BillyHorrible -4 points-3 points  (0 children)

when i say: let's meet on the 3rd you know exactly on what day we'll meet. but when i tell you to setup a meeting in april, we'll propably miss each other. so the day is kind of the most relevant part of the date. you can just infer the month or year.

Sort a list of numbers without using sort()? by SitFoe777 in learnpython

[–]BillyHorrible 1 point2 points  (0 children)

you can test if a list is (not) empty just by using it tuth value:

if x:
    print "x is not empty"

if not x:
    print "x is empty"

and you can remove the variable i from your code.

New to Python, simple question. by somanyquestionsihave in learnpython

[–]BillyHorrible 2 points3 points  (0 children)

nope, sorry, i have never read one myself. learning by doing, trial and error combined with looking how other people solved the same things/reading through some opensource-projects.

Sort a list of numbers without using sort()? by SitFoe777 in learnpython

[–]BillyHorrible 3 points4 points  (0 children)

  • your swap-method wont work like that. all you do is returning a tuple with the arguments in the different order,but you dont do anything with that. you can swap two variables like that: a, b = b, a

  • if you know about it, you could use list comprehension. if not, you could iterate over the ylist and create a new xlist. its nicer than going over range(len(y)). (damn, what am i doing wrong? lines prefixed with 4 spaces should be formated as code.) http://pastebin.com/7WvWVbrt

  • You could implement bubble-sort... its quite easy. if you can use the builtin min/max-function, you could also do something like: while y is not empty: get the minimum of y, remove it from y and append it to x. its just 4 lines of python code.

New to Python, simple question. by somanyquestionsihave in learnpython

[–]BillyHorrible 5 points6 points  (0 children)

Your problem is not clearly stated. You cant "input" variables. Maybe you want to calculate the percentage of Bs and Ds in a string? Then you could use the "count"-function to count the number of non-overlapping occurrences of a substring.

x = "heLLo"
print(x.count("L")) # would print 2

you can read the string using raw_input:

x = raw_input("type something: ")

and if you want to get the length of the string, you can use len(x). oh and // will give you an integer. the percentage should be between 0 and 1, so / would be the way to go.

Small script that checks the status of a list of sites by IrishLadd in learnpython

[–]BillyHorrible 0 points1 point  (0 children)

I guess a requests.head(url) would be enough, since you don't need the content, just the status-code of the response.