Skip to content

Commit 7e5bbce

Browse files
authored
Create random_test.py
Today, I learned about the "random" module in Python.
1 parent 672845b commit 7e5bbce

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

random_test.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import random
2+
3+
ran_float=random.random()
4+
print(ran_float)
5+
ran_int=random.randint(1,100)
6+
print(ran_int)
7+
my_list=[1,2,3,4,5,6,7,8,9,10,["abc","def"]]
8+
my_tuple=(1,2,3,("a","b","c"))
9+
my_string="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
10+
ran_choice1=random.choice(my_list)
11+
ran_choice2=random.choice(my_tuple)
12+
ran_choice3=random.choice(my_string)
13+
print(ran_choice1)
14+
print(ran_choice2)
15+
print(ran_choice3)
16+
17+
ran_shuffle1=random.shuffle(my_list)
18+
print(ran_shuffle1)

0 commit comments

Comments
 (0)