The code to generate a random number from 1 to 10 is as follows:
import random
print(random.randint(1,10))
The code is written in python.
Code explanation:
- The first line of code is used to import a module name "random". The random module is use to generate the random numbers.
- The second line of code, we use the object in random to generate integers from 1 to 10. The print statement is then used to print the random numbers from 1 to 10.
- Running the code we generate random numbers between 1 to 10 as required.
learn more on python code here: https://brainly.com/question/26104476?referrer=searchResults