How to get a random number in python?



How to get a random number in python?..

Answer / Jayvardhan Singh

In Python, you can use the `random` module's `randint()` function to generate a random integer within a specific range. For example: `import random; print(random.randint(1, 10))`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Can you remove the whitespaces from the string “aaa bbb ccc ddd eee”?

1 Answers  


How do I run python on linux?

1 Answers  


Is real python free?

1 Answers  


What is the use of isupper keyword in python?

1 Answers  


What is the difference between Python and PHP?

1 Answers  


How lists is differentiated from tuples?

1 Answers  


Tell me what is negative index in python?

1 Answers  


What are the differences between the threading and multiprocessing in python?

1 Answers  


What is deep copy in python?

1 Answers  


How can I make a time delay in python?

1 Answers  


What is python api?

1 Answers  


What are the types of inheritance in python?

1 Answers  


Categories