Generated by the communtiy
function datos12() {
data.map(elem => {
var graf = elem;
graf.map(elementos => {
setElemntos(elementos);
});
});
}
docstringFri, 10 Feb 2023 def add(a, b):
"""Returns the sum of a and b."""
return a + b
var name = "Mauricio"
var age = 30
var isDeveloper = true
var birthDate = new Date(1990, 7, 17)
var list = [name, age, isDeveloper, birthDate]
console.log(list)
def file_to_dict(file_name):
file_dict = {}
# open the file
with open(file_name) as f:
# loop through each line in the file
for line in f:
# remove new line character
key = line.rstrip()
# get the number of files in the directory
file_dict[key] = len(os.listdir(key))
return file_dict
def file_to_sorted_list(file_name):
file_dict = file_to_dict(file_name)
# return a list of directory name and number of files
return sorted(file_dict.items(), key=lambda kv: kv[1])
# test
for dir_name, number_of_files in file_to_sorted_list('directorios.txt'):
print(f'{dir_name} has {number_of_files} files')
def hack_instagram(username):
def age(name, age, address, phone, sex):
if age > 18:
print("Es mayor de edad")
else:
print("Es menor de edad")
if sex == "M":
print("Es hombre")
else:
print("Es mujer")
age("Maria", 26, "Calle 6", "123-4567", "F")
def age(name, age, address, phone, sex):
if age > 18:
print("Es mayor de edad")
else:
print("Es menor de edad")
if sex == "M":
print("Es hombre")
else:
print("Es mujer")
age("Maria", 26, "Calle 6", "123-4567", "F")
/^\d{8}[a-zA-Z]$/
Script
function processes(arr) {
var obj = {};
var p1_count = 0;
var p2_count = 0;
var a = 0;
var b = 0;
for (var i = 0; i < arr.length; i++) {
if (arr[i] === "PROC1") {
p1_count += 1;
a = p1_count;
} else {
p2_count += 1;
b = p2_count;
}
if (a === b) {
obj[arr[i]] = b;
a = 0;
b = 0;
}
}
return obj;
}
processes(["PROC1", "PROC1", "PROC1", "PROC2", "PROC2", "PROC2"]);
plt.figure(figsize = (12, 4))
plt.bar(data.index, data['nutri'], color = 'darkblue', label = 'nutri')
plt.bar(data.index, data['mineral'], color = 'brown', label = 'mineral')
plt.title('Comparison of Nutrient and Mineral Content')
plt.xlabel('Nutrient|Mineral')
plt.ylabel('Amount')
plt.legend()
plt.show()
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int numero;
cin >> numero;
for(int x = 1; x <= numero; x++)
{
double fx = pow(2.71828, 2 * x) - x;
cout << x << ' ' << fx << endl;
}
return 0;
}
a = input("a:")
b = input("b:")
if a > b:
print(a)
else:
print(b)
#
public static Panel CreatePanel()
{
var panel = new Panel();
var textBox = new TextBox();
textBox.Location = new Point(10, 10);
textBox.Size = new Size(200, 50);
panel.Controls.Add(textBox);
var button = new Button();
button.Location = new Point(10, 70);
button.Size = new Size(200, 50);
button.Text = "Execute";
panel.Controls.Add(button);
return panel;
}
private void button1_Click(object sender, EventArgs e)
{
var panel = CreatePanel();
Controls.Add(panel);
}
TypedQuery<Integer> query = entityManager.createQuery("SELECT MAX(received_volumetry) FROM audit.input_audit ORDER BY creation_date DESC LIMIT 30",Integer.class);
def algoritmo_genetico(valor_inicial, valor_final, formacion_de_parejas, numero_de_generaciones, probabilidad_de_cruzamiento, probabilidad_de_mutacion):
# Inicializamos la poblacion
poblacion = []
for i in range(0, numero_de_generaciones):
poblacion.append([])
for j in range(0
def mask_article(text, keyword):
return text.replace(keyword, "*"*len(keyword))
text = "今日のサンプルは金額です"
mask_article(text, "金額")
fix invalid codeSat, 20 May 2023 @media (prefers-reduced-motion: no-preference) {
* {
scroll-behavior: smooth;
}
}
vehiculos = []
def grabar(tipo, patente, marca, precio, multa_monto, multa_fecha, reg_fecha, dueño):
vehiculos.append([tipo, patente, marca, precio, multa_monto, multa_fecha, reg_fecha, dueño])
def buscar(patente):
for vehiculo in vehiculos:
if vehiculo[1] == patente:
print(vehiculo)
return True
return False
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 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
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
def find_max_square(arr):
max_square = 0
pos = 0
for i, x in enumerate(arr):
if x ** 2 > max_square:
max_square = x ** 2
pos = i
return pos, max_square
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
@Component({
name: "Masonry",
})
export default class GridLayout extends Vue {
@Prop({ default: false })
horizontal!: boolean;
@Prop({ default: 200 })
gutter!: number;
@Prop({ default: 0 })
column!: number;
@Prop({ default: null })
minWidth!: number | null;
@Prop({ default: null })
maxWidth!: number | null;
@Prop({ default: null })
breakpoint!: number | null;
@Prop({ default: true })
transition!: boolean;
@Prop({ default: "fade" })
transitionMode!: string;
@Prop({ default: 300 })
transitionDuration!: number;
private $slots = this.$slots;
private $props = this.$props;
private currentWidth: number = 0;
private currentGutterSize: number = 0;
private transitionDurationStyle
Python
translateThu, 23 Mar 2023 #include <stdio.h>
int main(int argc, char const *argv[])
{
int n;
printf("Ingrese tamaño del arreglo: \n");
scanf("%d", &n);
int numbers[n];
for (int i = 0; i < n; i++)
{
printf("Ingrese un numero: \n");
scanf("%d", &numbers[i]);
}
for (int i = 0; i < n; i++)
{
printf("El numero %d es: %d \n", i, numbers[i]);
}
return 0;
}
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()
#include <stdio.h>
float avg(int nums[ ], int n) {
int i, sum = 0;
for(i = 0; i < n; i++) {
sum += nums[i];
}
return ((float)sum)/n;
}
int main() {
int nums[] = {1, 2, 3, 4, 5};
printf("%f", avg(nums, 5));
}
function aumento(n){
var i = 0;
do{
n += 5;
i += 1;
}while(i<8)
return n;
}
aumento(5)
php
class Calculadora {
private $operacion;
private $operando1;
private $operando2;
private $operando3;
private $operando4;
private $operando5;
private $operando6;
private $operando7;
private $operando8;
private $operando9;
private $operando10;
private $operando
ript
function area(x) {
return x * x;
}
function perimetro(x) {
return x * 4;
}
function areaPerimetro(x) {
return x * x + x * 4;
}
function areaPerimetro2(x) {
return x * x + x * x + x * 4;
}
function areaPerimetro3
b <- c(1,1,1,1,1,1,1,0,0,0,0,0,0,0)
while (mean(b) > 0.40) {
b[sample(which(b==1), 1)] <- 0
}
b <- c(1,1,1,1,1,1,1,0,0,0,0,0,0,0)
while (mean(b) > 0.40) {
b[sample(which(b==1), 1)] <- 0
}
plt.figure(figsize = (12, 4))
plt.bar(data.index, data['nutri'], color = 'darkblue', label = 'nutri')
plt.bar(data.index, data['mineral'], color = 'brown', label = 'mineral')
plt.title('Comparison of Nutrient and Mineral Content')
plt.xlabel('Nutrient|Mineral')
plt.ylabel('Amount')
plt.legend()
plt.show()
lic double areaTriangle(double a, double b, double c)
{
return (a * b * Math.Sqrt(Math.Pow(c, 2) - Math.Pow(a, 2) - Math.Pow(b, 2))) / 2;
}
public double areaSquare(double a)
{
return a * a;
}
public double area
<div class="heart">
<div class="heart-main">
<div class="heart-line">
<div class="heart-line1"></div>
<div class="heart-line2"></div>
<div class="heart-line3"></div>
<div class="heart-line4"></div>
<div class="heart-line5"></div>
<div class="heart-line6"></div>
<div class="heart-line7"></div>
<div class="heart-line8"></div>
<div class="heart-line9"></div>
<div class="heart-line10"></div>
<div class="heart-line11"></div>
<div class="heart-line12"></div>
<div class="heart-line13"></div>
<div class="heart-line14"></div>
<div class="heart-line15"></div>
<div class="heart-line16"></div>
<div class="heart-line17"></div>
plt.figure(figsize = (12, 4))
plt.bar(data.index, data['nutri'], color = 'darkblue', label = 'nutri')
plt.bar(data.index, data['mineral'], color = 'brown', label = 'mineral')
plt.title('Comparison of Nutrient and Mineral Content')
plt.xlabel('Nutrient|Mineral')
plt.ylabel('Amount')
plt.legend()
plt.show()
function palindrome_check($string){
if (strrev($string) == $string){
echo "The string is a palindrome";
} else {
echo "The string isn't a palindrome";
}
}
palindrome_check("madam");
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
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()
SELECT name, year, war FROM database WHERE (war WHERE year=2002)+(war WHERE year=2003)>5
#include <iostream>
using namespace std;
int menu(){
int option;
cout << "1. Sumar dos numeros.\n";
cout << "2. Restar dos numeros.\n";
cout << "3. Multiplicar dos numeros.\n";
cout << "4. Dividir dos numeros.\n";
cout << "5. Número Primo?.\n";
cout << "6. Salir.\n";
cout << "Ingrese opción: ";
cin >> option;
return option;
}
int suma(int a, int b){
return a+b;
}
int resta(int a, int b){
return a-b;
}
int multiplicacion(int a, int b){
return a*b;
}
int division(int a, int b){
if (b == 0){
return 0;
}
return a/b;
}
def invoice(name, amount, **kwargs):
print(f"Name={name} Amount={amount}")
for k,v in kwargs.items():
print(f"{k} : {v}")
invoice("Paula", 100, tax=0.16, tip=1.2)
def factorial(x):
if x == 0:
return 1
return x * factorial(x - 1)
factorial(5)
UPDATE Projects SET name = TRIM(name);
SELECT SUM(Total) FROM Orders WHERE OrderDate LIKE "1998-01-%" AND EmployeeID=5;
#LMM
library(lme4)
m2 <- clm(categorical_FOD_FODs ~ 0 + Condition_FODs:Language_used_FODs - 1, random = ~1|subject, data = indvar_FODs)
summary(m2)
#LM
m2 <- clm(categorical_FOD_FODs ~ Condition_FODs:Language_used_FODs - 1, data = indvar_FODs)
summary(m2)
#post-hoc analysis
library(lsmeans)
contrast(m2, "pairwise", list(Condition_FODs = c("A", "B", "C", "D")))
library(emmeans)
emmeans(m2, pairwise~Condition_FODs, adjust = "bonferroni")
#LMM
library(lme4)
m2 <- clm(categorical_FOD_FODs ~ 0 + Condition_FODs:Language_used_FODs - 1, random = ~1|subject, data = indvar_FODs)
summary(m2)
#LM
m2 <- clm(categorical_FOD_FODs ~ Condition_FODs:Language_used_FODs - 1, data = indvar_FODs)
summary(m2)
#post-hoc analysis
library(lsmeans)
contrast(m2, "pairwise", list(Condition_FODs = c("A", "B", "C", "D")))
library(emmeans)
emmeans(m2, pairwise~Condition_FODs, adjust = "bonferroni")
<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>
def multiply(x, y)
return x * y
function Add(a, b) {
console.log(a + b)
}
Add(1, 2)
using System;
using Classes;
namespace SevenWonders
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
from random import randint
def diceRoll(userGuess, numRoll):
if userGuess == numRoll:
return True
else:
return False
def main():
numRoll = randint(1, 6)
userGuess = int(input("Guess a number from 1 to 6: "))
if diceRoll(userGuess, numRoll):
print("You win!")
else:
print("You lose. Better luck next time!")
main()
def reparto(monto):
carolina = 0.8*0.35*monto
diana = 0.35*monto
alfredo = 0.23*(diana + 0.25*monto)
cindy = 0.25*monto
pablo = monto - carolina - diana - alfredo - cindy
return carolina, diana, alfredo, cindy, pablo
reparto(1000)
import unittest
class TestCadena(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ['hello', 'world'])
# check that s.split fails when the separator is not a string
with self.assertRaises(TypeError):
s.split(2)
if __name__ == '__main__':
unittest.main()
function hablarEspañol(persona) {
if (persona === "español" || persona === "colombiano") {
console.log("¡Hola!");
} else {
console.log("¡Hablas inglés!");
}
}
import java.util.Scanner;
public class Ejercicio4 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
String[] novelas = { "El Alquimista", "Como agua para chocolate", "Cien años de soledad" };
String[] ciencia = { "La física de lo imposible", "El universo elegante", "La teoría del todo" };
String[] tecnologia = { "El futuro de la humanidad", "El viaje de la computadora", "La revolución de Bitcoin" };
System.out.println("Libros de Novelas");
System.out.println("================");
for (String i : novelas) {
System.out.println(i);
}
System.out.println("Libros de Ciencia");
System.out.println("================");
for (String i : ciencia) {
System.out.println(
def salario(salario_base):
if salario_base >= 500000 and salario_base <= 1000000:
return salario_base + (salario_base * 0.2)
else:
return salario_base
salario(500000)
salario(80000)
<a href="mailto:+79186788247">+79186788247</a>
void registrarCamion(int camion, int chofer)
{
if(camionesAgregados>=10)
return;
if(chofer>=10||chofer<0)
return;
if(choferes[chofer]==-1)
return;
if(camiones[camion]!=-1)
return;
camiones[camion]=chofer;
camionesAgregados++;
}
linkedHashMap.put(key, value)
def add(a, b):
print(a)
print(b)
return a + b
add(1, 2)
#include <iostream>
using namespace std;
int menu(){
int option;
cout << "1. Sumar dos numeros.\n";
cout << "2. Restar dos numeros.\n";
cout << "3. Multiplicar dos numeros.\n";
cout << "4. Dividir dos numeros.\n";
cout << "5. Número Primo?.\n";
cout << "6. Salir.\n";
cout << "Ingrese opción: ";
cin >> option;
return option;
}
int suma(int a, int b){
return a+b;
}
int resta(int a, int b){
return a-b;
}
int multiplicacion(int a, int b){
return a*b;
}
int division(int a, int b){
if (b == 0){
return 0;
}
return a/b;
}