forked from Vengence1005/Coding-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
array basic.py
116 lines (53 loc) · 994 Bytes
/
array basic.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#Code 1
'''
from array import *
a=array("i",[1,3,5,7,9])
print (a)
'''
'''
#Code 2
from numpy import *
a = linspace(0,10,4)
print (a)
b = logspace(1,6,3)
print(b)
c = arange(1,30,8)
print(c)
d = zeros(7)
print(d)
e = ones(7)
print(e)
'''
#Code 3
'''
from array import *
a = array("i",[1,3,5,7,9])
b = array("i",[2,4,5,8,9])
c = []
d =[]
e=[]
for i in range(5):
c.insert(i , a[i]==b[i])
d.insert(i, a[i] >=b[i])
e.insert(i, a[i]<=b[i])
print('Result of A<=B: ' , e)
print('Result of A==B: ' , c)
print('Result of A>B: ' , d)
'''
#Code 4
'''
from numpy import *
a = [2,4,6,8,10]
b = [2,0,6,0,10]
c = []
d =[]
e =[]
for i in range(5):
c.insert(i,logical_and(a[i]>0 , a[i]<4))
d.insert(i,logical_or( b[i]>0 , b[i]==6))
e.insert(i,logical_not(b[1]))
print(c)
print(e)
print(d)
'''
#Code 6