#random

Published: 01 October 2024
on channel: Mastering Technology
71
4

Generate Floating Numbers using a Random Module in Python.

Code:
import random as r

#generates float value b/w 0 and 1
val=r.random()
print(val)

#generates float value within a specific range
val1=r.uniform(5,9)
print(val1)

#using round function to limit two decimal values
val3=round(r.uniform(7,9),2)
print(val3)

#python #uniform #function #random #module #round #limit #decimal #values #shortcut #method #floating #numbers

#like #share #subscribemychannel


On this page of the site you can watch the video online #random with a duration of online in good quality, which was uploaded by the user Mastering Technology 01 October 2024, share the link with friends and acquaintances, this video has already been watched 71 times on youtube and it was liked by 4 viewers. Enjoy your viewing!