suma de matrices con vectores
import numpy as np
def add_matrix_and_vector(x, y):
return x + y
matrix = np.array([[1, 2], [3, 4]])
vector = np.array([6, 7])
add_matrix_and_vector(matrix, vector)
Generate code just by typing a text description. AI will create the code for you. Test it now
Generate
More than just a code generator. A tool that helps you with a wide range of tasks. All in one place.
Function from Description
Text Description to SQL Command
Translate Languages
Generate HTML from Description
Code to Explanation
Fix invalid Code
Get Test for Code
Class from Description
Regex from Description
Regex to Explanation
Git Command from Description
Linux Command
Function from Docstring
Add typing to code
Get Language from Code
Time complexity
CSS from Description
Meta Tags from Description
− sponsored −
Generated by the communtiy
import numpy as np
def add_matrix_and_vector(x, y):
return x + y
matrix = np.array([[1, 2], [3, 4]])
vector = np.array([6, 7])
add_matrix_and_vector(matrix, vector)
SELECT SUM(Total) FROM Orders WHERE OrderDate LIKE "1998-01-%" AND EmployeeID=5;
## 六、过程与思考(必填)
1. 你理解的实验标题和主题是什么?
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
int main()
{
float producto[3][4][12],promedio[4][12];
int i,j,k;
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
for(k=0;k<12;k++)
{
printf("Ingrese venta del producto %d, mes %d, año %d\n",i+1,j+1,k+1);
scanf("%f",&producto[i][j][k]);
}
}
}
for(j=0;j<4;j++)
{
for(k=0;k<12;k++)
{
promedio[j][k]=0;
for(i=0;i<3;i++)
{
promedio[j][k
You can use the following code to get the desired output.
function add(a, b) {
return a + b;
}
function subtract(a, b) {
return a - b;
}
function multiply(a, b) {
return a *
public static void addToLast(int[] a, int b) {
int count = a.length + 1; // 要素数が変わるので、別途 count 変数を用意する
int[] newArray = new int[count];
for (int i = 0; i < a.length; i++) {
newArray[i] = a[i];
}
newArray[count - 1] = b;
for (int i : newArray) {
System.out.print(i);
}
}
int[] arr = {1, 2, 3, 4, 5};
addToLast(arr, 6);
System.out.println(arr);
public string hillCipher(string key, string plainText)
{
string cipherText = "";
int[] keyInt = key.Select(c => (int)c).ToArray();
int[] plainTextInt = plainText.Select(c => (int)c).ToArray();
int[,] keyMatrix = new int[2, 2];
int[,] plainTextMatrix = new int[2, 1];
keyMatrix[0, 0] = keyInt[0] - 65;
keyMatrix[0, 1] = keyInt[1] - 65;
keyMatrix[1, 0] = keyInt[2] - 65;
keyMatrix[1, 1] = keyInt[3] - 65;
plainTextMatrix[0, 0] = plainTextInt[0] - 65;
plainTextMatrix[1, 0] = plainTextInt[1] - 65;
int[,] cipherTextMatrix = new int[2, 1];
cipherTextMatrix[0, 0] = (keyMatrix[0,
tmp_file.close
def multiply(x, y)
return x * y
html
<div class="input-group col-xs-12">
<input type="text" class="form-control">
<span class="input-group-addon">
<i class="fa fa-search"></i>
</span>
</div>
def download_file(url):
# download url
# return file_path
return file_path
import mysql.connector
conecction = mysql.connector.connect(host = '192.168.0.20', user = 'root', password = 'admin', database = 'FeedLot')
cursor = conecction.cursor()
def menu():
print("***************************************")
print("* 1. Archivo: *")
print("* 2. Reporte: *")
print("* 3. Consulta: *")
print("* 4. Salir: *")
print("***************************************")
def submenu():
print("***************************************")
print("* 1. Reporte semanal: *")
print("* 2. Reporte mensual: *")
print("* 3. Reporte anual: *")
print("* 4. Salir: *")
print("***************************************")
def crearReporte():
print("***************************************")
print("* 1. Reporte semanal: *")
print("
TypedQuery<Integer> query = entityManager.createQuery("SELECT MAX(received_volumetry) FROM audit.input_audit ORDER BY creation_date DESC LIMIT 30",Integer.class);
// Список битов с сообщения
// 1 бит - стартовый бит (1)
// 2 - 8 бит - биты сообщения (7 бит)
// 9 бит - бит паритета (должен быть равен чётности всех битов сообщения)
// 10 бит - стоп-бит (0)
char start_bit = 1;
char message_bit_1 = 0;
char message_bit_2 = 0;
char message_bit_3 = 0;
char message_bit_4 = 1;
char message_bit_5 = 0;
char message_bit_6
int main(int argc, char** argv) {
// Create a file reader
cv::VideoCapture cap;
// Open the video file
cap.open(0);
// Create a window to display the video
cv::namedWindow("Video");
// Show the image in the window
cv::imshow("Video", video);
// Wait for the user to press a button
cv::waitKey(0);
}
int main(){
int i;
for(i=8;i<=500;i+=8){
printf("\n%d",i);
}
return 0;
}
#include <stdio.h>
#include <pthread.h>
void *thread_func(void *arg) {
printf("New thread created\n");
return NULL;
}
int main() {
pthread_t tid;
pthread_create(&tid, NULL, thread_func, NULL);
pthread_join(tid, NULL);
return 0;
}
def mask_article(text, keyword):
return text.replace(keyword, "*"*len(keyword))
text = "今日のサンプルは金額です"
mask_article(text, "金額")
public string hillCipher(string key, string plainText)
{
string cipherText = "";
int[] keyInt = key.Select(c => (int)c).ToArray();
int[] plainTextInt = plainText.Select(c => (int)c).ToArray();
int[,] keyMatrix = new int[2, 2];
int[,] plainTextMatrix = new int[2, 1];
keyMatrix[0, 0] = keyInt[0] - 65;
keyMatrix[0, 1] = keyInt[1] - 65;
keyMatrix[1, 0] = keyInt[2] - 65;
keyMatrix[1, 1] = keyInt[3] - 65;
plainTextMatrix[0, 0] = plainTextInt[0] - 65;
plainTextMatrix[1, 0] = plainTextInt[1] - 65;
int[,] cipherTextMatrix = new int[2, 1];
cipherTextMatrix[0, 0] = (keyMatrix[0,
def print_people(people_list):
for p in people_list:
print(p[0], p[1])
print_people(people)
linkedHashMap.put(key, value)
onsole
mango
$1.00
pera
$1.50
tomate
$0.75
for(int i = 1; i <= 10; i++){
std::cout << i << std::endl;
}
func round(input float64) float64 {
return math.Floor(input*1000) / 1000
}
include <iostream>
int main(){
cout<<"Hello world!\n";
return 0;
}
int main(){
int i;
for(i=8;i<=500;i+=8){
printf("\n%d",i);
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main(){
int m,n;
scanf("%d",&m);
scanf("%d",&n);
if ((m>=1 && m<=50) && (n>=1 && n<=50)){
for (int i=0; i<n; i++){
for (int j=0; j<m; j++){
printf("*");
}
printf("\n");
}
}
return 0;
}
function isPrime(num) {
if (num === 2) {
return true;
} else if (num > 1) {
for (var i = 2; i < num; i++) {
if (num % i !== 0) {
return true;
}
}
}
return false;
}
console.log(isPrime(10))
df = pd.read_csv("/home/oscar/Documentos/python/data.csv")
df.head()
df['Nivel'].value_counts().plot(kind="bar", color=["green", "blue", "red"])
plt.xlabel("Nivel")
plt.ylabel("Frecuencia")
plt.title("Diagrama de barras")
plt.show()
void programar(a, z) {
if (a == z)
return a;
}
def while_loop(n):
while n > 0:
print n
n -= 1
print 'Blastoff!'
while (i <= 100) {
j = 2;
while (j <= (int) Math.sqrt(i)) {
if (i % j == 0) break;
// else
j++;
}
if (j > (int) Math.sqrt(i)) {
// i is prime
if (Math.sqrt(i) % 1 == 0) {
// i is square
System.out.println(i);
}
}
i++;
}
UPDATE Projects SET name = TRIM(name);
int main(){
char letra, mes[13];
printf("Ingrese una letra de la A a la L: ");
scanf("%c", &letra);
switch(letra){
case 'A':
case 'a':
printf("Enero");
break;
case 'B':
case 'b':
printf("Febrero");
break;
case 'C':
case 'c':
printf("Marzo");
break;
case 'D':
case 'd':
printf("Abril");
break;
case 'E':
case 'e':
printf("Mayo");
break;
case 'F':
case 'f':
printf("Junio");
break;
case 'G':
case 'g':
printf("Julio");
break;
case 'H':
case 'h':
printf("Agosto");
break;
case 'I':
case
for(int i = 1; i <= 10; i++){
std::cout << i << std::endl;
}
SELECT * FROM `order` where ctime between '2017-03-01' and '2017-05-22' and id in (select order_id from order_detail where status = 1 )
def print_people(people_list):
for p in people_list:
print(p[0], p[1])
print_people(people)
#include <iostream>
using namespace std;
int main() {
int n = 0;
float costo = 0;
cout << "Ingrese la cantidad de pelotas que desea comprar: \n";
cin >> n;
if (n <= 10){
costo = n * 7.00;
cout << "El valor total a pagar es: " << costo << " dolares" << endl;
}
else{
costo = n * 6.50;
cout << "El valor total a pagar es: " << costo << " dolares" << endl;
}
return 0;
}
#include <stdio.h>
int main(void) {
int N;
scanf("%d", &N);
int estaturas[N];
for (int i = 0; i < N; i++) {
scanf("%d", &estaturas[i]);
}
int posicion;
scanf("%d", &posicion);
printf("%d", estaturas[posicion]);
return 0;
}
You can use the following code to get the desired output.
function add(a, b) {
return a + b;
}
function subtract(a, b) {
return a - b;
}
function multiply(a, b) {
return a *
def get_police_users(department):
import ldap
import re
from openpyxl import Workbook
from openpyxl import load_workbook
wb = Workbook()
ws = wb.active
# connect to active directory
conn = ldap.initialize('ldap://ldap.yourdomain.com')
# search for users in department in active directory
results = conn.search_s('dc=yourdomain,dc=com', ldap.SCOPE_SUBTREE, "department=" + department, ['cn'])
# create spreadsheet and add users in department to it
ws.append(["Users"])
for result in results:
ws.append([re.findall('(?<=cn=).*', result[1]['cn'][0].decode('utf-8'))[0]])
wb.save("output.xlsx")
# open spreadsheet and sort by last name
wb = load
function Add(a, b) {
console.log(a + b)
}
Add(1, 2)
void programar(a, z) {
if (a == z)
return a;
}
/^\d{8}[a-zA-Z]$/
function Add(a, b) {
console.log(a + b)
}
Add(1, 2)
void programar(a, z) {
if (a == z)
return a;
}
/^\d{8}[a-zA-Z]$/
linkedHashMap.put(key, value)
int a, b;
Console.WriteLine("Dame dos numeros para dividirlos");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine("El resultado de la división entera es {0}", DivEntera(a, b));
Console.WriteLine("El resultado de la división decimal es {0}", DivDecimal(a, b));
int DivEntera(int a, int b)
{
return a / b;
}
double DivDecimal(int a, int b)
{
return (double) a/b;
}
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.axes(projection=ccrs.PlateCarree())
plt.contourf(lon, lat, temp_data[0, :, :], 60, transform = ccrs.PlateCarree())
plt.colorbar(orientation='horizontal', shrink = 0.8)
plt.show()
printf("\n1. Cálculo de perímetro de circunferencia\n");
printf("2. Área de circunferencia\n");
printf("3. Volumen de la esfera\n");
printf("4. Salir\n");
printf("\nIngrese una opción: ");
scanf("%d",&opcion);
fn swap(left: &mut usize, right: &mut usize) {
let temp = *left;
*left = *right;
*right = temp;
}
fn main() {
let mut left = 1;
let mut right = 2;
swap(&mut left, &mut right);
println!("left: {}, right: {}", left, right);
}
SELECT * FROM `order` where ctime between '2017-03-01' and '2017-05-22' and id in (select order_id from order_detail where status = 1 )
void programar(a, z) {
if (a == z)
return a;
}
SELECT string_agg(case data_type
when 'character varying' then 'text'
when 'integer' then 'integer'
when 'double precision' then 'real'
when 'jsonb' then 'jsonb'
end,',') FROM information_schema.columns where table_schema='public' and table_name='customers';
def train_test_split(X, y, test_size = 0.15):
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = test_size, random_state = 54)
return X_train, X_test, y_train, y_test
def split_pairs(text):
if len(text) % 2 == 0:
for i in range(0, len(text),2):
print(text[i] + text[i+1])
else:
for i in range(0, len(text)-1, 2):
print(text[i] + text[i+1])
print(text[-1] + '_')
def f(x):
def g(y):
return y + x + 3
return g
nf1 = f(1)
nf2 = f(3)
nf1(1)
nf2(1)
#include <stdio.h>
#include <stdlib.h>
int main(){
int m,n;
scanf("%d",&m);
scanf("%d",&n);
if ((m>=1 && m<=50) && (n>=1 && n<=50)){
for (int i=0; i<n; i++){
for (int j=0; j<m; j++){
printf("*");
}
printf("\n");
}
}
return 0;
}
using System;
using Classes;
namespace SevenWonders
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
var products = [
{ name: 'Galletas', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' },
{ name: 'Bebidas', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' },
{ name: 'Comida', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' },
{ name: 'Papas', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' },
{ name: 'Tortas', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' },
]
var carousel = document.getElementById('carousel');
var html = '';
html += '<div class="products">'
for (var i = 0; i < products.length; i++) {
html += '<div class="product">';
html += '<
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>
using System;
using Classes;
namespace SevenWonders
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}