How To Print Random Number in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How To Print Random Number in Python?

i wanna print it in my dictionary in a tabular form

19th Aug 2018, 5:26 AM
Rishabh Mehta
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.
19th Aug 2018, 10:12 AM
Ipang
+ 3
by using random module check it. https://youtu.be/KzqSDvzOFNA
19th Aug 2018, 10:03 AM
Maninder $ingh
Maninder $ingh - avatar
+ 3
thnx guyz 😍 thank you
19th Aug 2018, 12:58 PM
Rishabh Mehta
+ 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))
19th Aug 2018, 6:26 AM
Arun Sharma
Arun Sharma - avatar