Added: 8th of December 2020
Viewed: 343 times
The following code below generates a random number from 1 to 10 using Python3.
To generate a random number, we must first import the random module, by entering import random at the top of our script.
We can generate a random number by using the random.randit() function and assign it to the variable random_number
After this we use the print command to display the random number.
Copy and paste the code below
Other Tips & Tutorials
Python3Learning Python 3, check user input is an integer
Posted: 11th of December 2020
Python3Learning Python3, Generate a random number using Python3
Posted: 8th of December 2020
Python3Learning Python 3, getting basic user input and printing the results
Posted: 7th of December 2020
Python3Learning Python3, System calls on Linux
Posted: 1st of December 2020
Python3Create a new window using GTK and Python in Ubuntu and Ubuntu based distributions
Posted: 19th of November 2020
Python3How to create a basic Python3 script in Ubuntu and Ubuntu based distributions
Posted: 28th of April 2020