loading

This Plugin Crashed!

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

# Create the following rank 2 array with shape (3, 4)
# [[ 1  2  3  4]
#  [ 5  6  7  8]
#  [ 9 10 11 12]]
a = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]])

# Use slicing to pull out the subarray consisting of the first 2 rows
# and columns 1 and 2; b is the following array of shape (2, 2):
# [[2 3]
#  [6 7]]
b = a[:2, 1:3]

# A slice of an array is a view into the same data, so modifying it
# will modify the original array.
print(a[0, 1])   # Prints "2"
b[0, 0] = 77     # b[0, 0] is the same piece of data as a[0, 1]
print(a[0, 1])   # Prints "77"