Double Color Ball Winning Verification Python Code + Randomly Generated Lottery Numbers

I previously saw a marketing account post a video about the current situation of young people in South Korea, who don't want to get married or buy a house and just want to lay flat, buying scratch cards for fun and hoping to win a big prize to continue laying flat happily.

After entering society for 6 or 7 years, the once naive little boy is no longer young, and the promises of the past have become all about money!

So I plan to spend a few tens of dollars every day to buy some lottery tickets, maybe I can win a big prize and continue to lay flat (I think my luck has been pretty good over the years, except for gambling luck...).


Generate Random Lottery Numbers#

The code was written by chatgpt...

Double Color Ball#

import random
import time

def generate_double_color_balls(num_tickets=5):
    tickets = []
    for _ in range(num_tickets):
        current_time = int(time.time())  # Get current timestamp
        random.seed(current_time)  # Use current timestamp as random seed

        # Generate red ball numbers, randomly select 6 non-repeating numbers from 1 to 33
        red_balls = random.sample(range(1, 34), 6)
        # Sort red ball numbers
        # Generate blue ball number, randomly select 1 number from 1 to 16
        blue_ball = random.randint(1, 16)
        tickets.append((red_balls, blue_ball))
    return tickets

if __name__ == "__main__":
    num_tickets = 5  # Generate 5 sets of double color ball numbers
    tickets = generate_double_color_balls(num_tickets)
    for i, (red_balls, blue_ball) in enumerate(tickets, 1):
        print(f"Set {i} double color ball numbers:")
        print("Red balls:", red_balls)
        print("Blue ball:", blue_ball)

Fucai 3D#

import random
import time

def generate_fc3d_numbers():
    current_time = int(time.time())  # Get current timestamp
    random.seed(current_time)  # Use current timestamp as random seed
    numbers = [random.randint(0, 9) for _ in range(3)]  # Generate 3 random numbers between 0 and 9
    return numbers

if __name__ == "__main__":
    fc3d_numbers = generate_fc3d_numbers()
    print(f"Fucai 3D numbers: {''.join(map(str, fc3d_numbers))}")


import random
import time

def generate_qlc_numbers():
    numbers = []
    current_time = int(time.time())  # Get current timestamp
    random.seed(current_time)  # Use current timestamp as random seed

    for _ in range(5):
        # Generate 7 non-repeating red ball numbers (range from 1 to 30) randomly
        red_balls = random.sample(range(1, 31), 7)
        # Shuffle the order of red ball numbers randomly
    return numbers

if __name__ == "__main__":
    qlc_numbers = generate_qlc_numbers()
    for i, red_balls in enumerate(qlc_numbers, start=1):
        print(f"Set {i} Qilecai numbers:")
        print("Red balls:", red_balls)

Lottery Number Verification#

I spent 10 dollars to play 5 sets of numbers, but I'm too lazy to check them one by one. I'm also afraid that if I win by some miracle, I won't be able to find out...

API application address: https://www.mxnzp.com/doc/detail?id=3

import requests

def check_lottery_result(api_url, app_id, app_secret, lottery_code, expect, lottery_no):
    # Build request parameters
    params = {
        'code': lottery_code,   # Lottery type
        'expect': expect,       # Lottery period number
        'lotteryNo': lottery_no,  # User-selected numbers
        'app_id': app_id,       # Your API application ID
        'app_secret': app_secret  # Your API application secret key

    # Send GET request
    response = requests.get(api_url, params=params)

    if response.status_code == 200:
        result = response.json()
        return result
        print("Request failed")
        return None

if __name__ == "__main__":
    # API URL
    api_url = "https://www.mxnzp.com/api/lottery/common/check"
    # Application address: https://www.mxnzp.com/doc/detail?id=3
    app_id = "xxx"
    app_secret = "xxxxxx"

    while True:
        # User-selected lottery type
        print("Please select the lottery type:")
        print("1. Double Color Ball (ssq)")
        print("2. Qilecai (qlc)")
        choice = input("Enter the number to choose the lottery type (1 or 2): ")

        if choice == "1":
            lottery_code = "ssq"
        elif choice == "2":
            lottery_code = "qlc"
            print("Invalid choice, please enter again")

        user_input_expect = input("Enter the period number (without prefix 23): ")  # Manually enter the period number (without prefix 23)
        # Add "23" in front of the user input period number
        expect = "23" + user_input_expect
        red_balls = input("Enter the red ball numbers (separated by spaces): ").split()  # Manually enter the red ball numbers
        blue_ball = input("Enter the blue ball number: ")  # Manually enter the blue ball number

        # Build the user-selected numbers
        lottery_no = ",".join(red_balls) + "@" + blue_ball

        # Check the result
        result = check_lottery_result(api_url, app_id, app_secret, lottery_code, expect, lottery_no)
        if result:
            if result["code"] == 1:
                print("Query successful")
                print("Winning information: " + result["data"]["resultDetails"])  # Display winning information and the queried numbers
                print("Query failed:", result["msg"])
            print("Query failed")

        another = input("Do you want to continue querying? (Enter y to continue, any other key to exit): ")
        if another.lower() != 'y':

It's best not to have too high expectations for these things, just have some fun, and don't get involved in gambling (whether online or offline).

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.