How to use random function in python and different use cases

Published: 17 March 2024
on channel: Engineering Dabba
14
0

Hello viewers, I have created this video to explain you about random function in python and different types of options are available with random functions hope you like this video see you in next video soon thanks.

Code:
#random values

import random

#random values

vara=random.random()
print(vara)

print("\n")
#random int value
vara1=random.randint(1,1000)
print(vara1)



print("\n")
#random from list

var12=["dhiadhiad",1232,"dbaidha",2424,"bfuagh","hodiajf",1213,424.252]

tra=random.choice(var12)
print(tra)

#random,randint,choice,shuffle,sample
print("print old:",var12)
random.shuffle(var12)
print("new file:",var12)
#sample
print(random.sample(var12,3))


On this page of the site you can watch the video online How to use random function in python and different use cases with a duration of hours minute second in good quality, which was uploaded by the user Engineering Dabba 17 March 2024, share the link with friends and acquaintances, this video has already been watched 14 times on youtube and it was liked by 0 viewers. Enjoy your viewing!