+ 2
How To Print Random Number in Python?
i wanna print it in my dictionary in a tabular form
4 Answers
+ 4
LAZY GHOST this question tags should not include c++, java or c, it's confusing others which language your question was about.
+ 3
by using random module check it.
https://youtu.be/KzqSDvzOFNA
+ 3
thnx guyz đ thank you
+ 2
# Python code to demonstrate the working of
# choice() and randrange()
# importing "random" for random operations
import random
# using choice() to generate a random number from a
# given list of numbers.
print ("A random number from list is : ",end="")
print (random.choice([1, 4, 8, 10, 3]))
# using randrange() to generate in range from 20
# to 50. The last parameter 3 is step size to skip
# three numbers when selecting.
print ("A random number from range is : ",end="")
print (random.randrange(20, 50, 3))