Generated by the communtiy
import requests
def get_token():
return '835500611:AAF4cO6d0U6xRU6O-kSbY_Pf5G2f5Z5q5KQ'
def get_url():
token = get_token()
return f'https://api.telegram.org/bot{token}/'
def get_updates():
url = get_url() + 'getUpdates'
response = requests.get(url)
return response.json()
# Add a rectangle
color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255) )
pygame.draw.rect(screen, color, [random.randint(0, 200), random.randint(0, 200), 50, 50])
def big_vowels(sentence, word):
def sum_of_integers(n):
sumatoria = 0
for i in range(1, 101):
if i % n == 0:
sumatoria += i
return sumatoria
sum_of_integers(3)
def sum_of_integers(n):
sumatoria = 0
for i in range(1, 101):
if i % n == 0:
sumatoria += i
return sumatoria
sum_of_integers(3)
Python
categories.of.variable <- function(x){
return(length(levels(x)))
}
def vosk(question, answer):
#Vosk
return answer
A = {1,2,3,4,5}
B = {4,5,6,7,8}
A | B
def hack(n):
return n * n * n * n * n * n * n * n * n * n
hack(100000000000)
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
}
int add(int a, int b) {
return a + b;
}
int sub(int a, int b) {
return a - b;
}
int main() {
int a = 0, b = 0;
cin >> a;
cin >> b;
cout << add(a, b) << endl;
cout << sub(a, b) << endl;
return 0;
}
def sum_of_integers(n):
sumatoria = 0
for i in range(1, 101):
if i % n == 0:
sumatoria += i
return sumatoria
sum_of_integers(3)
++
bool S1 = 0;
bool S2 = 0;
bool S3 = 0;
bool S4 = 0;
bool S5 = 0;
bool S6 = 0;
bool S7 = 0;
bool S8 = 0;
bool S9 = 0;
bool S10 = 0;
bool S11 = 0;
bool S12 = 0;
bool S13 = 0;
bool S14 = 0;
bool S15 = 0;
bool S16 = 0;
void setup() {
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(S4, OUTPUT);
pinMode(S5, OUTPUT);
pinMode(S6, OUTPUT);
pinMode(S7, OUTPUT);
pinMode(S8, OUTPUT);
pinMode(S9, OUTPUT);
pinMode(S10, OUTPUT);
pinMode(S11, OUTPUT);
pinMode(S12
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()
// Список битов с сообщения
// 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);
}
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);
div class="container" id="main">
<div class="chat">
<div class="chat-header">
<div class="chat-avatar">
<img src="img/avatar.png" alt="Avatar">
</div>
<div class="chat-name">
<span class="chat-username">
<a href="#">
<span class="chat-username-text">
<span class="chat-username-text-inner">
<span class="chat-username-text-in
#include <iostream>
using namespace std;
int main() {
float diff_d1, diff_d2, diff_d3;
do {
cout << "Inserire il valore dei dadi del difensore:\n";
cin >> diff_d1 >> diff_d2 >> diff_d3;
} while (diff_d1 < 0 || diff_d1 > 6 || diff_d2 < 0 || diff_d2 > 6 || diff_d3 < 0 || diff_d3 > 6 || (diff_d1 == 0 && diff_d2 == 0 && diff_d3 == 0));
}
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;
}
}
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';
# -*- coding: utf-8 -*-
# Copyright (c) 2019, DigiThinkIT and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ProductDetector(Document):
pass
// TODO code application logic here
package Lista_Simplemente_Enlazadas;
import java.util.Scanner;
/**
*
* @author Juan Camilo
*/
public class Lista_Simplemente_Enlazadas {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Lista lista = new Lista();
int opcion = 0;
int dato = 0;
int posicion = 0;
do {
System.out.println("\nMENU");
System.out.println("1. Insertar al inicio de la lista");
System.out.println("2. Mostrar los elementos de la lista");
System.out.println("3. Insertar en la posición enésima");
System.out.println("4. Devolver la posición enésima de un elemento");
System.out.println("5. Ordenar los elementos de forma crecient
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:
def hipotenusa(a, b):
return a**2 + b**2
hipotenusa(3, 4)
A:
Python 3.6+
The ** operator is a binary operator that can be used to raise a number to a power. It is equivalent to the ** operator in Python 2.7+, but is more readable and more efficient.
>>> 3 ** 2
A = 1
B = 3
C = 0
S = A
if B > S then S = B
if C > S then S = C
if A > S then A = S
if B > S then B = S
if C > S then C = S
if A > S then A = S
if B > S then B = S
if C > S then C = S
if A > S then A = S
if B > S then B = S
if C > S then C = S
print S
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++;
}
int a, b;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine(a+b);
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("
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
//in MainTransactionForm.Xaml.cs
public partial class MainTransactionForm : Form
{
public MainTransactionForm()
{
InitializeComponent();
}
private void withdrawButton_Click(object sender, EventArgs e)
{
LoginForm loginForm = new LoginForm();
loginForm.WithdrawChecking();
}
}
//in LoginForm.Xaml.cs
class LoginForm
{
public void WithdrawChecking()
{
if(true)
{
MessageBox.Show("withdraw checking");
}
}
}
let sql = require('sql')
sql.query(sql.select().from(table).toString())
int main (){
int n=0;
do{
n++;
if (n%2==0)
cout<<n<<endl;
}while(n<=100);
}
TYPE html>
<html>
<head>
<title>PC Stand</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="container">
<div id="header">
<h1>PC Stand</h1>
</div>
<div id="content">
<h2>About</h2>
<p>
The PC Stand is a project I started in the summer of 2015. I wanted to make a stand for my
<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>
import os
def speak(text):
os.system(f'powershell.exe -Command "Add-Type -AssemblyName System.speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak(\'{text}\');"')
speak('Test')
The regex matches the first bracket, then any character, then any number of characters, then a comma.
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++;
}
translateSun, 02 Jul 2023 Script
function add(a, b) {
return a + b;
}
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);
}
}
++
#include<stdio.h>
#include<stdlib.h>
int main()
{
int opcion;
do
{
printf("1. if \n");
printf("2. if else\n");
printf("3. for\n");
printf("4. while \n");
printf("5. do while \n");
printf("6. salir \n");
scanf("%d",&opcion);
switch(opcion)
{
case 1:
printf("Usted eligio la opcion if");
break;
case 2:
printf("Usted eligio la opcion if else");
break;
case 3:
printf("Usted eligio la opcion for");
break;
case 4:
printf("Usted eligio la opcion while");
break;
case 5:
printf("Usted eligio la opcion do while");
break;
case 6:
printf("Usted eligio la opcion salir");
break;
default:
printf("opcion invalida");
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')
#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;
}
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");
unction of the human body is to maintain homeostasis. The body is constantly adapting to the environment and to the internal environment. The body is constantly adapting to the environment and to the internal environment. The body is constantly adapting to the environment and to the internal environment. The body is constantly
tmp_file.close
## 六、过程与思考(必填)
1. 你理解的实验标题和主题是什么?
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;
}
func round(input float64) float64 {
return math.Floor(input*1000) / 1000
}
int a, b;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine(a+b);
import spacy
import sys
import pickle
nlp = spacy.load('en_core_web_sm', disable=['parser', 'tagger'])
def extract_experience(text):
doc = nlp(text)
X = pd.DataFrame([[ent.text, ent.start_char, ent.end_char, ent.label_] for ent in doc.ents],
columns = ["text", "start", "end", "label"])
X_test = X[X["label"] == "ORG"].copy()
X_test["tokens"] = X_test["text"].apply(lambda x: [token.text for token in x.split()])
with open(f"model.pkl", 'rb') as f:
model = pickle.load(f)
y_pred = model.predict(X_test["tokens"])
return list(zip(X_test["text"], y_pred))
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>
ript
function mayor(numero) {
if (numero > 9) {
return true;
} else {
return false;
}
}
console.log(mayor(5)); // false
console.log(mayor(10)); // true
A:
El problema es que estás usando el operador de asignación (=) en lugar del operador de comparación (==).
TypedQuery<Integer> query = entityManager.createQuery("SELECT MAX(received_volumetry) FROM audit.input_audit ORDER BY creation_date DESC LIMIT 30",Integer.class);
The regex matches the first bracket, then any character, then any number of characters, then a comma.
function lastNonNumber(number) {
var a = number.toString();
var b = a.replace(/\d$/, '');
return parseInt(b);
}
lastNonNumber(2342341)
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;
}
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
def download_file(url):
# download url
# return file_path
return file_path
for(int i = 1; i <= 10; i++){
std::cout << i << std::endl;
}
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()
import java.util.Scanner;
public class Empleado{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String nombre, cargo;
int id, horario, salario, numeroID;
boolean horarioTurno = false, identificacion = true;
System.out.println("Ingrese el número de empleados a registrar: ");
int numeroEmpleados = sc.nextInt();
for(int i=0; i < numeroEmpleados; i++){
if(numeroEmpleados <= 10){
System.out.println("Ingrese el nombre: ");
nombre = sc.nextLine();
System.out.println("Ingrese el cargo: ");
cargo = sc.nextLine();
System.out.println("Ingrese el número de identificación: ");
numeroID = sc.nextInt();
System.out.println("
#include <iostream>
#include <vector>
using namespace std;
int menor(vector<int> v){
int minimo = v[0];
int posicion = 0;
for(int i=0; i<v.size(); i++){
if(v[i] < minimo){
minimo = v[i];
posicion = i;
}
}
return posicion;
}
int eliminar(vector<int> &v, int posicion){
int valor = v[posicion];
for(int i=posicion; i< v.size(); i++){
v[i] = v[i+1];
}
v.pop_back();
return valor;
}
int main(){
vector<int> v1 = {1,2,3,4};
vector<int> v2 = {6,5,8,7};
vector<int> v3;
int n = v1.size();