Generated by the communtiy
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
function add(a, b) {
return a + b;
}
add(1, 2);
## 六、过程与思考(必填)
1. 你理解的实验标题和主题是什么?
def forward_to_goatse(ip, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('goatse.cx', 80))
s.listen(0)
while 1:
(incoming_socket, address) = s.accept()
incoming_socket.send(b'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<html><body><img src="http://goatse.cx/"></body></html>')
incoming_socket.close()
function checkValidOrderIdOnly(s)
{
let len = s.length;
if (len !== 17) throw new Error('参数错误,orderid非法');
let v = parseInt(s);
if (!Number.isFinite(v))
throw new Error('参数错误,orderid非法');
let d = new Date(v);
if (d.getTime() !== v)
throw new Error('参数错误,orderid非法');
let now = Date.now();
if (v > now || v < now - 24 * 60 * 60 * 1000)
throw new Error('参数错误,orderid非法');
}
#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
int salary;
if salaries > 50000:
salary = 50000
else:
salary = salaries
print("You are hired")
return salary
def mask_article(text, keyword):
return text.replace(keyword, "*"*len(keyword))
text = "今日のサンプルは金額です"
mask_article(text, "金額")
def 乗り継ぎ(a, b):
return a * b
def serie(resistencias):
total = 0
for resistencia in resistencias:
total += resistencia
return total
def paralelo(resistencias):
total = 0
for resistencia in resistencias:
if resistencia == 0:
return 0
total += 1 / resistencia
return 1 / total
def total(resistencias, tipo):
if tipo == "serie":
return serie(resistencias)
elif tipo == "paralelo":
return paralelo(resistencias)
else:
print("Tipo de resistencia no reconocida")
return None
resistencias = []
while True:
cantidad = int(input("Ingrese la cantidad de resistencias: "))
if cantidad > 0:
break
print("Ingrese una cantidad positiva")
for i in range(cantidad):
while True:
fun calculateInterest(plan: Int, price: Double): Double {
return when (plan) {
12 -> price * 1.12
24 -> price * 1.17
else -> price
}
}
translateSun, 02 Jul 2023 Script
function add(a, b) {
return a + b;
}
SELECT SUM(Total) FROM Orders WHERE OrderDate LIKE "1998-01-%" AND EmployeeID=5;
def mask_article(text, keyword):
return text.replace(keyword, "*"*len(keyword))
text = "今日のサンプルは金額です"
mask_article(text, "金額")
Ship::Ship(ShipType type,const std::vector<Coordinate *> &positions)
{
this->type = type;
this->positions = positions;
}
def menu():
print("1. datos personales")
print("2. Notas de cursos")
print("3. Ausencias y Tardías")
print("4. Salir")
opcion = int(input("Ingrese una opción >> "))
if opcion == 1:
datos_personales()
elif opcion == 2:
notas()
elif opcion == 3:
ausencias()
elif opcion == 4:
exit()
else:
print("Opción incorrecta")
def datos_personales():
print("Ingrese sus datos")
nombre = input("Nombre >> ")
apellido = input("Apellido >> ")
edad = input("Edad >> ")
sexo = input("Sexo >> ")
print("")
print("Datos Ingresados")
print("Nombre: "
for(int i = 1; i <= 10; i++){
std::cout << i << std::endl;
}
private void extract_Click(object sender, EventArgs e)
{
string input = data.Text;
string[] parts = input.Split(',');
foreach (string part in parts)
{
listBox1.Items.Add(part);
}
}
function Add(a, b) {
console.log(a + b)
}
Add(1, 2)
def login(user, password):
while(True):
i = 0
while(i<3):
if(user == 'a' and password == 'b'):
print('Welcome')
return True
else:
print('Wrong username or password')
i = i + 1
user = input('User: ')
password = input('Password: ')
print('You have exceeded the maximum number of attempts')
return False
login('a', 'b')
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);
for (int i = 0; i < n / 2; i++) {
for (int j = i; j < n - i - 1; j++) {
int tmp = mat[i][j];
mat[i][j] = mat[j][n - i - 1];
mat[j][n - i - 1] = mat[n - i - 1][n - j - 1];
mat[n - i - 1][n - j - 1] = mat[n - j - 1][i];
mat[n - j - 1][i] = tmp;
}
}
TypedQuery<Integer> query = entityManager.createQuery("SELECT MAX(received_volumetry) FROM audit.input_audit ORDER BY creation_date DESC LIMIT 30",Integer.class);
function checkValidOrderIdOnly(s)
{
let len = s.length;
if (len !== 17) throw new Error('参数错误,orderid非法');
let v = parseInt(s);
if (!Number.isFinite(v))
throw new Error('参数错误,orderid非法');
let d = new Date(v);
if (d.getTime() !== v)
throw new Error('参数错误,orderid非法');
let now = Date.now();
if (v > now || v < now - 24 * 60 * 60 * 1000)
throw new Error('参数错误,orderid非法');
}
def print_people(people_list):
for p in people_list:
print(p[0], p[1])
print_people(people)
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 hack(n):
return n * n * n * n * n * n * n * n * n * n
hack(100000000000)
categories.of.variable <- function(x){
return(length(levels(x)))
}
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;
}
#include <Servo.h>
Servo myservo;
int ledPin = 13;
int servoPin = 9;
int buttonPin = 2;
int buttonValue = 0;
int counter = 0;
void setup() {
myservo.attach(servoPin);
pinMode(ledPin, OUTPUT);
pinMode(servoPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonValue = digitalRead(buttonPin);
if (buttonValue == HIGH) {
counter++;
digitalWrite(ledPin, HIGH);
myservo.write(180);
delay(1000);
digitalWrite(ledPin, LOW);
myservo.write(0);
delay(1000);
}
else {
if (counter % 2 == 1) {
digitalWrite(ledPin, HIGH);
myservo.write(180);
delay(1000);
digitalWrite(ledPin, LOW);
myservo
int main(){
int i;
for(i=8;i<=500;i+=8){
printf("\n%d",i);
}
return 0;
}
#include <stdio.h>
int main()
{
char message[100], ch;
int i, key;
printf("Enter a message to encrypt: ");
gets(message);
printf("Enter key: ");
scanf("%d", &key);
for(i = 0; message[i] != '\0'; ++i){
ch = message[i];
if(ch >= 'a' && ch <= 'z'){
ch = ch + key;
if(ch > 'z'){
ch = ch - 'z' + 'a' - 1;
}
message[i] = ch;
}
else if(ch >= 'A' && ch <= 'Z'){
ch = ch + key;
if(ch > 'Z'){
ch = ch - 'Z' + 'A' - 1;
}
message[i] = ch;
}
}
printf("Encrypted message: %s", message);
return 0
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)
ALCULADORA DE PENTAGONO CON UN LADO
import math
def area(lado):
area = lado * lado * math.sqrt(25 + 10 * math.sqrt(5)) / 4
return area
area(2)
1: Create table clientes (
id int not null primary key,
name varchar(255) not null,
email varchar(255) not null,
password varchar(255) not null)
2: Create table admin (
id int not null primary key,
name varchar(255) not null,
email varchar(255) not null,
password varchar(255) not null)
private void extract_Click(object sender, EventArgs e)
{
string input = data.Text;
string[] parts = input.Split(',');
foreach (string part in parts)
{
listBox1.Items.Add(part);
}
}
function Dice() {
this.value = 0;
this.numberOfThrows = 0;
this.renderTo = "";
}
Dice.prototype.render = function () {
document.querySelector(this.renderTo).innerHTML = this.value;
};
Dice.prototype.throw = function () {
this.numberOfThrows++;
this.value = Math.ceil(Math.random() * 6);
};
Dice.prototype.getNumberOfThrows = function () {
return this.numberOfThrows;
};
Dice.prototype.getValue = function () {
return this.value;
};
int a, b;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine(a+b);
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
float hipotenusa;
float cateto1,cateto2;
printf("Cateto 1: ");
scanf("%f",&cateto1);
printf("Cateto 2: ");
scanf("%f",&cateto2);
hipotenusa= sqrt(pow(cateto2,2)+pow(cateto1,2));
printf("La hipotenusa es: %f\n ",hipotenusa);
printf("El area es: %f\n",cateto1*cateto2/2);
return 0;
}
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)
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 += '<
function datos12() {
data.map(elem => {
var graf = elem;
graf.map(elementos => {
setElemntos(elementos);
});
});
}
int salary;
if salaries > 50000:
salary = 50000
else:
salary = salaries
print("You are hired")
return salary
int add(int a, int b) {
return a + b;
}
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()
1: Create table clientes (
id int not null primary key,
name varchar(255) not null,
email varchar(255) not null,
password varchar(255) not null)
2: Create table admin (
id int not null primary key,
name varchar(255) not null,
email varchar(255) not null,
password varchar(255) not null)
int a, b;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine(a+b);
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);
}
fun calculateInterest(plan: Int, price: Double): Double {
return when (plan) {
12 -> price * 1.12
24 -> price * 1.17
else -> price
}
}
fun calculateInterest(plan: Int, price: Double): Double {
return when (plan) {
12 -> price * 1.12
24 -> price * 1.17
else -> price
}
}
function hablarEspañol(persona) {
if (persona === "español" || persona === "colombiano") {
console.log("¡Hola!");
} else {
console.log("¡Hablas inglés!");
}
}
a = input("a:")
b = input("b:")
if a > b:
print(a)
else:
print(b)
int a, b;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine(a+b);
int main()
{
int a, b, c;
cin>>a>>b>>c;
if(a>b && a>c)
{
cout<<a<<" ";
if(b>c)
cout<<b<<" "<<c;
else
cout<<c<<" "<<b;
}
else if(b>a && b>c)
{
cout<<b<<" ";
if(a>c)
cout<<a<<" "<<c;
else
cout<<c<<" "<<a;
}
else if(c>a && c>b)
{
cout<<c<<" ";
if(a>b)
cout<<a<<" "<<b;
else
cout<<b<<" "<<a;
}
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()
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
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);
import mysql.connector
import hashlib
import sys
def login(username, password):
"""
"""
# Create connection
mydb = mysql.connector.connect(
host="localhost",
user="user",
passwd="pass",
database="mydatabase"
)
# Create cursor to execute queries
cursor = mydb.cursor()
# Create query and execute
query = f"SELECT * FROM login WHERE username = '{username}'"
cursor.execute(query)
# Fetch all results
result = cursor.fetchall()
# Check if query was successful
if result == []:
print("Invalid username and/or password")
return
# Check if user exists
if len(result) != 1:
print("ERROR: More than one user exists")
return
# Check if password is correct
# Load password from database
db_password = result[0][1]
# Encrypt password
SELECT SUM(Total) FROM Orders WHERE OrderDate LIKE "1998-01-%" AND EmployeeID=5;
++
void intercambiar(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
void main()
{
int a, b;
cout << "a = "; cin >> a;
cout << "b = "; cin >> b;
intercambiar(&a, &b);
cout << "a = " << a << endl;
cout << "b = " << b << endl;
}
const subMenuEl = document.querySelector("#sub-menu")
const mainEl = document.querySelector("#main")
subMenuEl.addEventListener("click", function(event) {
const h1El = document.createElement("h1")
h1El.innerHTML = event.target.innerHTML
mainEl.innerHTML = ""
mainEl.appendChild(h1El)
})
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++;
}