Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in

Posted on

Create basic server in Python

Create basic server - Python:

def create_server(name, os, ram, cpu):
    Create a server with the given parameters.

    name : str
        The name of the server.
    os : str
        The operating system of the server.
    ram : int
        The amount of RAM in GB.
    cpu : int
        The number of CPUs.

        A dictionary containing the server parameters.

    #create a dictionary with the given parameters
    server = {'name': name, 'os': os, 'ram': ram, 'cpu': cpu}

    #return the dictionary
    return server

server = create_server('web-server', 'ubuntu', 8, 4)
print(server)  #{'name': 'web-server', 'os': 'ubuntu', 'ram': 8, 'cpu': 4}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)