Python Generating Random numbers

Get started learning Python with DataCamp's free Intro to Python tutorial. Learn Data Science by completing interactive coding challenges and watching videos by expert instructors. Start Now!

Python random  module contains function to generate random numbers. So first you need to import random  module using the following line.

import random

random() Function

random()  function returns random number r  such that 0 <= r < 1.0

Expected Output:

randint(a, b)  generate random numbers between a  and b  (inclusively).

Next chapter will cover file handling techniques in python.

Other Tutorials

This site generously supported by DataCamp. DataCamp offers online interactive Python Tutorials for Data Science. Join over a million other learners and get started learning Python for data science today!

Leave a Reply

Be the First to Comment!

Notify of
avatar

wpDiscuz