-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlibraries.py
54 lines (41 loc) · 1.11 KB
/
libraries.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#importing all the modules inside the random
import random
df = random.choice(["Gowda","Chandu","Test"])
print (df)
#importing a specific choice from the random module
from random import choice
df = choice(["A","B","C","D"])
print (df)
#getting additional pic between 2 integers from the module random
import random
num = random.randint(1,100)
print (num)
#from the random library using the shuffle
import random
cards=["K","Q","J"]
random.shuffle(cards)
print (cards) #print in a single line
for i in cards: #using a for loop to get the shuffle data in rows
print(i)
#module statistics getting familiar with the stats modules.
import statistics
df=statistics.mean([10,20])
print(df)
import sys
if len(sys.argv)<2:
print("less Arguments")
elif len(sys.argv)>2:
print("Many arguments")
else:
print("Hello, My Name is",sys.argv[1])
#if we use the yield function any number of values can be generated
#yield
def main():
n=int(input("give a range: "))
for s in sheep(n):
print(s)
def sheep(n):
for i in range(n):
yield ("*"*i)
if __name__=="__main__":
main()