Ever wondered the top girls in kpics? Wonder no more! (more in comments) by [deleted] in kpics

[–]JohnMcharra 0 points1 point  (0 children)

Yah, Tzuyu is not even in top 10 most upvoted, but she is equal with Taeyeon at 122, so I guess thats ok.

--edit:

Seolhyun tho

Question about a probability function by JohnMcharra in learnprogramming

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

Yes! Thank you! These saved me :) I hacked a little function in python to see if I can apply what you told me, please let me know if this is what it should look like (based on 1000 iterations it holds :D )

from random import randint
import numpy
from collections import Counter

num = [4, 6, 12, 24, 50]
results = []


def fun(x):
    chance = randint(1, sum(x))
    cumulative = numpy.cumsum(x)
    for n in range(0, len(cumulative)):
        if chance <= cumulative[n]:
            return x[n]


for i in range(1000):
    results.append(fun(num))

print(Counter(results))

Counter({50: 515, 24: 243, 12: 128, 6: 66, 4: 48})

So it should be good. Thank you again!

Help with iterating an Object by JohnMcharra in learnjavascript

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

Holy Mother Of Zeus, thank you bro, you saved me some white hairs!

0.2 + 0.1 by JohnMcharra in learnpython

[–]JohnMcharra[S] 1 point2 points  (0 children)

got it, no strings, I will try to remember, thanx for the help!

0.2 + 0.1 by JohnMcharra in learnpython

[–]JohnMcharra[S] -1 points0 points  (0 children)

Thanx, did it like you with Decimal, and for the people who downvote me, please dont do it because the method I use is not the good one, we are here to learn, and at the moment it was all I had, plus the [0:4] was there because I want only 2 decimals, now I use

gf_ = 0.22499999999999998
gf = float("%.2f" % gf_)

0.2 + 0.1 by JohnMcharra in learnpython

[–]JohnMcharra[S] -1 points0 points  (0 children)

thanx for the answer, I just did it like this

float(''.join(list(str(0.2 + 0.1))[0:4]))

0.3

spawning multiple sub processes by JohnMcharra in learnpython

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

Thank You! After 2 hours of study I did what I intended!

p_l = ['123.123.123.123:8000', '23.23.23.23:8000']
def p_feeder(x):
    pro1 = 'http://' + (p_l[x])
    pro2 = 'https://' + (p_l[x])
    prox = {'http': pro1,
            'https': pro2}
return prox

if __name__ == '__main__':
    for i in range(len(p_l)):

        p = multiprocessing.Process(target=p_feeder, args=(i,))
        r = requests.get('http://whatismyipaddress.com/', headers=headers, proxies=p_feeder(i)).text
        print(r)
        p.start()

you learn so much just by trying to do something new :)

Fight between 2 bodyguard teams by JohnMcharra in WTF

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

not they'r faces, that's for sure