loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.5273923295280512","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IG51bXB5IGFzIG5wCgojIENyZWF0ZSBhIG5ldyBhcnJheSBmcm9tIHdoaWNoIHdlIHdpbGwgc2VsZWN0IGVsZW1lbnRzCmEgPSBucC5hcnJheShbWzEsMiwzXSwgWzQsNSw2XSwgWzcsOCw5XSwgWzEwLCAxMSwgMTJdXSkKCnByaW50KGEpICAjIHByaW50cyAiYXJyYXkoW1sgMSwgIDIsICAzXSwKICAgICAgICAgICMgICAgICAgICAgICAgICAgWyA0LCAgNSwgIDZdLAogICAgICAgICAgIyAgICAgICAgICAgICAgICBbIDcsICA4LCAgOV0sCiAgICAgICAgICAjICAgICAgICAgICAgICAgIFsxMCwgMTEsIDEyXV0pIgoKIyBDcmVhdGUgYW4gYXJyYXkgb2YgaW5kaWNlcwpiID0gbnAuYXJyYXkoWzAsIDIsIDAsIDFdKQoKIyBTZWxlY3Qgb25lIGVsZW1lbnQgZnJvbSBlYWNoIHJvdyBvZiBhIHVzaW5nIHRoZSBpbmRpY2VzIGluIGIKcHJpbnQoYVtucC5hcmFuZ2UoNCksIGJdKSAgIyBQcmludHMgIlsgMSAgNiAgNyAxMV0iCgojIE11dGF0ZSBvbmUgZWxlbWVudCBmcm9tIGVhY2ggcm93IG9mIGEgdXNpbmcgdGhlIGluZGljZXMgaW4gYgphW25wLmFyYW5nZSg0KSwgYl0gKz0gMTAKCnByaW50KGEpICAjIHByaW50cyAiYXJyYXkoW1sxMSwgIDIsICAzXSwKICAgICAgICAgICMgICAgICAgICAgICAgICAgWyA0LCAgNSwgMTZdLAogICAgICAgICAgIyAgICAgICAgICAgICAgICBbMTcsICA4LCAgOV0sCiAgICAgICAgICAjICAgICAgICAgICAgICAgIFsxMCwgMjEsIDEyXV0pCg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import numpy as np

# Create a new array from which we will select elements
a = np.array([[1,2,3], [4,5,6], [7,8,9], [10, 11, 12]])

print(a)  # prints "array([[ 1,  2,  3],
          #                [ 4,  5,  6],
          #                [ 7,  8,  9],
          #                [10, 11, 12]])"

# Create an array of indices
b = np.array([0, 2, 0, 1])

# Select one element from each row of a using the indices in b
print(a[np.arange(4), b])  # Prints "[ 1  6  7 11]"

# Mutate one element from each row of a using the indices in b
a[np.arange(4), b] += 10

print(a)  # prints "array([[11,  2,  3],
          #                [ 4,  5, 16],
          #                [17,  8,  9],
          #                [10, 21, 12]])