Custom ChatGPT Plugin development

ConversAI Solutions

Code faster with the help of AI

Generate code just by typing a text description. AI will create the code for you. Test it now

Questions about programming?Chat with your personal AI assistant

How others used it recently

Generated by the communtiy

generate functionWed, 21 Dec 2022

dice gambling script

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()

Python
Guest
generate functionTue, 25 Apr 2023

suponga que el precio unitario de las pelotas de baseball es de 6.50 dolares si se compran 10 o mas y 7.00 dolares en caso de comprar menos. imprima no solo el costo sino tambien el mensaje descuento o el mensaje sin descuento

#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; }

C++
Guest
generate functionFri, 21 Apr 2023

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)

Python
Guest
generate functionSun, 23 Apr 2023

conectarse a una base de datos llamada FeedLot de sql en la direccion 192.168.0.20, con nombre de usario root y contraseña admin, este codigo debe ser en python, despues que accesa debe entrar a una p...

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("

Python
Guest
generate functionTue, 20 Jun 2023

create a ChatGpt clone

void chatbot() { while(true) { string userinput; getline(cin, userinput); if(userinput == "hello") cout << "Hello!" << endl; else if(userinput == "why are you so stupid?") cout << "because i am a bot" << endl; else cout << "i dont understand" << endl; } }

C++
Guest
generate functionSun, 04 Dec 2022

Offline speak function for windows

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')

Python
Guest
generate functionTue, 21 Mar 2023

Add to this the code for generating a grid on the chart, as well as specifying the percentage difference directly on the chart bars plt.figure(figsize = (12, 4)) plt.bar(data.index, data['nutri'], co...

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()

Python
View User
generate functionMon, 10 Jul 2023

a) Escriba una función que reciba un vector de enteros y obtenga la posición del menor entero. b) Escriba una función que reciba un vector de enteros y una posición, elimine el entero en esa posición...

#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();

C++
Guest
generate functionFri, 30 Jun 2023

1. Cálculo de la suma de todos los elementos de un vector, así como la media aritmética. arreglos unidimensionales

public class Ejercicio02 { public static void main(String[] args) { int[] numeros = new int[20]; int suma = 0; int media; System.out.println("Array original:"); for (int i = 0; i < 20; i++) { numeros[i] = (int)(Math.random() * 401); System.out.print(numeros[i] + " "); suma += numeros[i]; } System.out.println("\n\nArray modificado:"); media = suma / 20; for (int i = 0; i < 20; i++) { if (numeros[i] < media) { numeros[i] = numeros[i] * -1; } System.out.print(numeros[i] + " "); } } }

Java
Guest
generate functionMon, 12 Dec 2022

get a list of users from active directory from police department, output to spreadsheet, order column by name

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

Python
Guest
generate functionThu, 20 Apr 2023

quiero generar un boton que me permita seleccionar opciones utilizanzo react. que me permita filtrar las opciones mediante el texto que muestran y que tambien permita limpiar la seleccion con un icono de cruz en el costado derecho

import React from 'react'; import { Button, Input, Icon } from 'antd'; interface MyButtonProps { selectedOptions: any[]; onSelectedOptionsChange: (selectedOptions: any[]) => void; options: any[]; } const MyButton: React.FC<MyButtonProps> = ({ selectedOptions, onSelectedOptionsChange, options }) => { const [ text, setText ] = React.useState<string>(''); const [ dropdown, setDropdown ] = React.useState<boolean>(false); const [ filteredOptions, setFilteredOptions ] = React.useState<any[]>(options); const handleDropdown = () => { setDropdown(!dropdown); }; const handleTextChange = (e: any) => { const text = e.target.value; setText(text); const filteredOptions = options.filter(opt => opt.text.indexOf(text) > -1); setFil

TypeScript
Guest
generate functionFri, 31 Mar 2023

arduino nanoで、奇数回ボタンを押せばサーボモータが動きながらLEDが光り、偶数回ボタンを押せばサーボモータが元の状態に戻り、LEDが消えるプログラムをC言語で書いてください。

#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

C
Guest
generate functionSat, 22 Apr 2023

un codigo para hacer un sistema basico de movimiento

public class Movimiento { public bool MovimientoBasico(int[] posicion, int[] destino) { if ( destino == posicion ) { return false; } else if ( destino[0] >= posicion[0] ) { posicion[0] ++; } else if ( destino[0] <= posicion[0] ) { posicion[0] --; } else if ( destino[1] >= posicion[1] ) { posicion[1] ++; } else if ( destino[1] <= posicion[1] ) { posicion[1] --; } else { return false; } return true; } }

C#
Guest
generate functionSun, 04 Dec 2022

How to access WithdrawChecking() in LoginForm inside MainTransactionForm

//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"); } } }

C#
Guest
text to sql syntaxWed, 22 Mar 2023

Crear dos tablas con constraints

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)

Guest
generate functionWed, 26 Jul 2023

Haz un mapa de Argentina

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()

Python
Guest
text to sql syntaxThu, 27 Apr 2023

Funcio o procediment anomenat Premis_Proven_RHY que generi numero de 1 al 50. Premis_Proven_RHY rebra el numero premiat del sorteigi retorna el premi aconseguit. numero premiat si va del 1 al 20 50 euros, si va de 20 al 30 dinar a la cantina , si va de 30 a 50 un bono bus

DROP PROCEDURE IF EXISTS Premis_Proven_RHY; DELIMITER // CREATE PROCEDURE Premis_Proven_RHY(OUT numero_premiat INT) BEGIN SET numero_premiat = FLOOR(1 + RAND() * 50); END // DELIMITER ; CALL Premis_Proven_RHY(@premi); SELECT @premi;

Guest
regex explanationTue, 09 May 2023

/^[{].+},/

The regex matches the first bracket, then any character, then any number of characters, then a comma.

Guest
generate functionThu, 20 Apr 2023

quiero generar un boton que me permita seleccionar opciones utilizanzo react. que me permita filtrar las opciones mediante el texto que muestran y que tambien permita limpiar la seleccion con un icono de cruz en el costado derecho

import React from 'react'; import { Button, Input, Icon } from 'antd'; interface MyButtonProps { selectedOptions: any[]; onSelectedOptionsChange: (selectedOptions: any[]) => void; options: any[]; } const MyButton: React.FC<MyButtonProps> = ({ selectedOptions, onSelectedOptionsChange, options }) => { const [ text, setText ] = React.useState<string>(''); const [ dropdown, setDropdown ] = React.useState<boolean>(false); const [ filteredOptions, setFilteredOptions ] = React.useState<any[]>(options); const handleDropdown = () => { setDropdown(!dropdown); }; const handleTextChange = (e: any) => { const text = e.target.value; setText(text); const filteredOptions = options.filter(opt => opt.text.indexOf(text) > -1); setFil

TypeScript
Guest
generate functionSat, 01 Apr 2023

Make a dice class - The class should have a throw method that simulates throwing a die. It returns the number thrown, but it also stores in the instance how many we have thrown, whic...

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; };

Javascript
Guest
generate functionTue, 21 Mar 2023

Add to this the code for generating a grid on the chart, as well as specifying the percentage difference directly on the chart bars plt.figure(figsize = (12, 4)) plt.bar(data.index, data['nutri'], co...

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()

Python
View User
generate functionMon, 08 May 2023

推送公告

Script def push_notice(message): for user in users: user.receive_message(message) push_notice('hello!')

Java
Guest
generate functionSun, 05 Feb 2023

9. Разработайте приложение «7 чудес света», где каждое чудо будет представлено отдельным классом. Создайте дополнительный класс, содержащий точку входа. Распределите приложение по файлам проекта и с помощью пространства имён обеспечьте возможность взаимодействия классов.

using System; using Classes; namespace SevenWonders { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } }

C#
Guest
generate functionFri, 05 Apr 2024

add 2 numbers and return them

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 *

TypeScript
Guest
generate functionFri, 05 May 2023

Create a Google Chrome extension that, upon activation, opens a new tab in the browser with its graphical interface. The interface should have the necessary options and filters to search for a keyword...

# -*- 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

Python
Guest
generate functionSun, 04 Dec 2022

How to access WithdrawChecking() in LoginForm inside MainTransactionForm

//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"); } } }

C#
Guest
generate functionSat, 01 Apr 2023

Make a dice class - The class should have a throw method that simulates throwing a die. It returns the number thrown, but it also stores in the instance how many we have thrown, whic...

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; };

Javascript
Guest
text to sql syntaxWed, 22 Mar 2023

Crear dos tablas con constraints

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)

Guest
generate functionSun, 30 Apr 2023

Implementar una Calculadora de Números Enteros, mediante un proyecto de consola en C++, cuyo algoritmo permita: 1. Mostrar un menú de 6 opciones: • 1. Sumar dos números. • 2. Restar dos números. • 3. ...

#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; }

C++
Guest
generate functionWed, 12 Apr 2023

Realizar un script en Python que calcule las resistencias en paralelo o en serie, pidiendo primero la cantidad de resistencias, luego el tipo de conexión en formato string si es en “serie” o en “paral...

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:

Python
Guest
generate functionSun, 11 Jun 2023

Escribir un programa que lea las dimensiones de una matriz, la visualice y encuentre su mayor y su menor elemento y sus posiciones respectivas.

Script const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout }) readline.question(`dime cuantas filas quieres`, (rows) => { readline.question(`dime cuantas columnas quieres`, (columns) => { console.log(`Vamos a crear una matriz de ${rows} filas y ${columns} columnas`) let matrix = createMatrix(rows, columns) printMatrix(matrix) let minInfo = getMin(matrix) console.log(`El minimo es: ${minInfo.value} y está en las posiciones (${minInfo.i}, ${minInfo.j})`) let maxInfo = getMax(matrix) console.log(`El maximo es: ${maxInfo.value} y está en las posiciones (${maxInfo.i}, ${maxInfo.j})`) readline.close()

generate functionWed, 22 Mar 2023

funcion operar

def operar(a, b, op): if op == "add": return a + b elif op == "sub": return a - b elif op == "mul": return a * b elif op == "div": return a / b else: return "not valid" operar(1, 2, "mul")

Java
Guest
generate functionTue, 02 May 2023

programa para hacer sucesiones de cuadrados en consola grafica

#include <math.h> #include <graphics.h> #include <iostream> using namespace std; int main() { int gd = DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); int x1, y1, x2, y2; x1 = 50; y1 = 50; int n; cout << "ingrese el numero de cuadrados:"; cin >> n; cout << "ingrese el lado del cuadrado"; cin >> x2; y2 = x2; for (int i = 1; i <= n; i++) { rectangle(x1, y1, x2, y2); x1 = x1 - 10; y1 = y1 - 10; x2 = x2 + 20; y2 = y2 + 20; } getch();

C++
Guest
ContactPrivacy Policyzigarettenautomatkarte.de