crear un modulo que tire un valor random del 1 al 10
import random
def randon_number():
return random.randint(1,10)
All generations.
import random
def randon_number():
return random.randint(1,10)
Script
function draw() {
var x = random(0, width);
var y = random(0, height);
var r = random(10, 20);
var g = random(0, 255);
var b = random(0, 255);
fill(g, b, r);
ellipse(x, y, r, r);
}
Script
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
function changeColor() {
var x = getRandomColor();
document.getElementById("first").style.backgroundColor = x;
}
int x = 0;
void setup() {
size(400, 400);
}
void draw() {
background(220);
line(x, 0, x, height);
}
void keyPressed() {
if (key == 'd'){
x = x + 3;
}
}
public static void main(String[] args) {
System.out.println("hello world");
}
Script
def askName():
name = input("What's your name?: ")
return "Hello " + name
Script
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
getRandomColor()
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
getRandomColor()
Script
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
getRandomInt(10)
Script
function generateBubblesForNumbers(numbers) {
let container = document.createElement('div');
container.style.display = 'flex';
container.style.flexWrap = 'wrap';
for (var i = 0; i < numbers.length; i++) {
var number = numbers[i];
let bubble = document.createElement('div');
bubble.style.backgroundColor = 'blue';
bubble.style.width = '30px';
bubble.style.height = '30px';
bubble.style.borderRadius = '50%';
bubble.style.display = 'flex';
bubble.style.alignItems = 'center';
bubble.style.justifyContent = 'center';
bubble.style.margin = '5px';
bubble.textContent = number;
container.appendChild(bubble);
}
document.body.appendChild(container);
}
generateBubblesForNumbers([1, 2, 3, 4, 5, 6, 7, 8,
//Con Java
public void Polenta(int porciones, int agua, int caldo, int polenta) {
System.out.println(agua * (3/porciones));
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.print("Cantidad de porciones a preparar: ");
Scanner sc = new Scanner(System.in);
int cantidad = sc.nextInt();
System.out.println("Lista de ingredientes necesarios");
System.out.println("2 kg de harina");
System.out.println("1 kg de levadura");
System.out.println("1 kg de agua");
System.out.println("Pasos a seguir");
System.out.println("1. Colocar todos los ingredientes en un recipiente.");
System.out.println("2. Mezclar bien los ingredientes.");
System.out.println("3. Dejar reposar durante 2 horas.");
System.out.println("4. Hornear durante 30 minutos.");
}
}
from random import randint
def add():
a = randint(1, 4)
b = randint(1, 4)
return a + b
add()
Script
def color():
pass
Script
import {random, randomColor} from './lib/util.js'
document.querySelector('button').onclick = () => {
const div = document.createElement('div')
div.style.top = `${random(500)}px`
div.style.left = `${random(500)}px`
div.style.backgroundColor = randomColor()
document.body.appendChild(div)
}
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