-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3.2.6
More file actions
35 lines (27 loc) · 825 Bytes
/
3.2.6
File metadata and controls
35 lines (27 loc) · 825 Bytes
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
# import numpy as np
# # Input array from the user
# array1 = np.array(list(map(int, input().split())))
# # Searching
# search_value = int(input("Value to search: "))
# count_value = int(input("Value to count: "))
# broadcast_value = int(input("Value to add: "))
# # Sort the first array
import numpy as np
# Input array from the user
array1 = np.array(list(map(int, input().split())))
# Searching
search_value = int(input("Value to search: "))
count_value = int(input("Value to count: "))
broadcast_value = int(input("Value to add: "))
# Find indices where value matches in array1
a=np.where(array1==search_value)[0]
print(a)
# Count occurrences in array1
b=np.count_nonzero(array1==count_value)
print(b)
# Broadcasting addition
c = array1 + broadcast_value
print(c)
# Sort the first array
d=np.sort(array1)
print(d)