Computer Science, asked by venkataramanablr2020, 1 month ago

python program please help me ​

Attachments:

Answers

Answered by jhabhuvash
1

i = 1

v = 1000^1000

for i in range(v):

                     i += 1

print(1)

Answered by Equestriadash
5

list1 = [10, 45, 67, 34, 89]

1. To convert list1 into an array named array1 and print it.

\tt import\ numpy\ as\ np\\array1\ =\ np.array(list1)\\print(array1)

2. To add 3 to every element in array1 and store the result in array2. Array2 is to be printed after that.

\tt array2\ =\ np.array(array1\ +\ 3)\\print(array2)

3. To print the odd elements from array1.

\tt for\ i\ in\ array1:\\{\ \ \ \ \ }if\ i\%2\ !=\ 0:\\{\ \ \ \ \ }{\ \ \ \ \ }print(i)

4. To print the first, last and middle element of array2.

\tt print(array2[0],\ array2[4],\ array2[2])

5. To create an array named array3 using the \tt np.arange() function from 10 to 50 at intervals of 10.

\tt array3\ =\ np.arange(10,\ 50,\ 10)

6. To sort array1 using a NumPy function.

\tt array1.sort()\\print(array1)

7. To create an array named array4 of dimensions 3 × 4 and perform tasks after it.

\tt array4\ =\ np.array([[[10,\ 20,\ 30,\ 40],\ [50,\ 60,\ 70,\ 80],\ [90,\ 110,\ 120,\ 130]]])

  • Number of dimensions:

\tt array4.ndim

  • Shape of the array:

\tt array4.shape

  • Length of the array:

\tt array4.size

Similar questions