You can download this code by clicking the button below.
This code is now available for download.
This function creates a simple web service using the Bottle framework that generates and returns a random number between 1 and 100 to the user.
Technology Stack : Bottle, Random
Code Type : Web service
Code Difficulty : Intermediate
from bottle import route, run, request, response, static_file
def random_route():
@route('/random')
def get_random():
import random
num = random.randint(1, 100)
return f"Your random number is: {num}"
return get_random
# Code Information