Mistři v programování na #hovnokod

Python #496

import string
import random
import itertools


def random_pop(container):
    random_index = random.randint(0, len(container) - 1)
    random_item = container.pop(random_index)

    return random_item

def main():
    phone_numbers = list(itertools.permutations(string.digits, 6))

    # TODO: Read from file.
    names = ['Gretchin-dragger', 'Tooth-destroyer', 'Rat-cutter', 'Horse-snapper', 'Blood-stalker', 'Head-killer', 'Rot-cutter', 'Enemy-throttler', 'Horse-kicker', 'Tree-thrower', 'Dark-smasher', 'Rat-snapper', 'Raven-cutter', 'Public-basher', 'Arm-stalker', 'Dwarf-gut', 'Death-hunter', 'Glory-raider', 'Talon-thrower', 'Torch-dragger', 'Blade-eater', 'Blade-rapist', 'Evil-smasher', 'Eye-breaker', 'Gretchin-dragger', 'Knife-licker', 'Torch-basher', 'Teeth-juggler', 'Human-hammer', 'Goblin-basher', 'Man-hammer', 'Beast-dragger', 'Elf-throttler', 'Hair-crusher', 'Wraith-raider', 'Claw-smasher', 'Hobbit-thrower', 'Dragon-rapist', 'Night-slayer', 'Grass-hacker', 'Hobbit-crusher', 'Torch-crusher', 'Public-poker', 'Power-terror', 'Foot-slammer', 'Raven-killer', 'Hell-slayer', 'Troll-kicker', 'Night-kicker', 'Power-slicer', 'Erorz', 'Kark', 'Vradash', 'Prirg', 'Eraagor', 'Prilo', 'Vrurt', 'Graadish', 'Erink', 'Ponak', 'Kruurug', 'Runk', 'Guuol', 'Vaagdish', 'Kuuurk', 'Prugdush', 'Braag', 'Kalg', 'Pik', 'Ginak', 'Honk', 'Girk', 'Kurk', 'Vrar', 'Hagor', 'Bralo', 'Graashnak', 'Birug', 'Gaalg', 'Gilg', 'Praurk', 'Kugash', 'Prorz', 'Kaurk', 'Vraag', 'Pragar', 'Krar', 'Ranak', 'Braaurk', 'Grak', 'Erolo', 'Vugor', 'Hug', 'Kraadash', 'Prugar', 'Bag', 'Horug', 'Hogdush', 'Krak', 'Kridush']

    locations = ['Ankatavaka', 'Darken-Wood', 'Haven', 'Gateway', 'Pax-Tharkas', 'Plains-of-Dust', 'Schallsea', 'Que-Shu', 'Citadel-of-Light', 'Hedge-Maze', 'Solace', 'Inn-of-the-Last-Home', "Last-Heroes'-Tomb", 'Academy-of-Sorcery', "Gods'-Row", 'Sad-Town', 'Tarsis', 'Xak-Tsaroth', 'Zhaman', 'Skullcap', 'Saifhum', 'Karthay', 'Mithas', 'Kothas', 'Silver-Dragon-Mountain', 'Silvanost', 'Qualinost', "Anaya's-Tree", 'Dargaard-Keep', 'Estwilde', 'Kalaman', "High-Clerist's-Tower", 'Knightlund', 'Nightlund', 'Palanthas', 'Thieves-Guild', 'Vingaard-Keep', 'Blood-Sea-of-Istar', 'Lattakay', 'Flotsam', 'Kendermore', 'Port-Balifor', 'Losarcum', 'Winterheim', 'Icewall', 'Mount-Nevermind', 'Whitestone', 'Godshome', 'Neraka', 'Sanction', 'Dragon-Isles', 'Hillhome', 'Thorbardin', 'Kharolis', 'Khur', 'Nordmaar', 'Teyr', 'Thoradin', 'Mithandrus', 'Kal-Thax', 'Lost-Citadel', 'Hillow', 'Zakhalax', 'Kayolin', 'Blodehelm', 'Missing-City']

    def random_prefix():
        seed = random.random()
        random_digit = string.digits[random.randint(0, 9)]
        prefix = '022'
        phone_type = 'mobile'

        if 0.3 > seed:
            prefix = '06%s' % random_digit
        elif 0.6 > seed > 0.31:
            prefix = '07%s' % random_digit
        elif seed > 0.61:
            phone_type = 'home'

        return prefix, phone_type

    phone_type = None
    for i in range(50):
        prefix, phone_type = random_prefix()
        phone_number = ''.join(random_pop(phone_numbers))
        name = random_pop(names)
        location = random_pop(locations)

        delimiter = ','
        print(delimiter.join([name, location, prefix + phone_number, phone_type]))


if __name__ == '__main__':
    main()

HovnoKod,