Create basic server - Python:
def create_server(name, os, ram, cpu):
"""
Create a server with the given parameters.
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.
Returns
-------
dict
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
#example
server = create_server('web-server', 'ubuntu', 8, 4)
#output
print(server) #{'name': 'web-server', 'os': 'ubuntu', 'ram': 8, 'cpu': 4}
Top comments (0)