What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-24 04:24:08
how to sort a list randomly in python
import random number_list = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70] print("Original list:", number_list) random.shuffle(number_list) print("List after first shuffle:", number_list) random.shuffle(number_list) print("List after ... Add solution -
Other 2021-10-22 03:44:12
load test script locust
# This locust test script example will simulate a user # browsing the Locust documentation on https://docs.locust.io import random from locust import HttpUser, between, task from pyquery import PyQuery class AwesomeUser(HttpUser): host = "htt... Add solution -
Python 2021-10-22 01:02:08
pygame snake
import pygame import time import random pygame.init() white = (255, 255, 255) yellow = (255, 255, 102) black = (0, 0, 0) red = (213, 50, 80) green = (0, 255, 0) blue = (50, 153, 213) dis_width = 600 dis_height = 400 dis = pygam... Add solution -
Python 2021-10-21 18:37:09
snake python
import pygame import numpy import random import math pygame.init() clock = pygame.time.Clock() screen = pygame.display.set_mode((377, 377)) grid = numpy.zeros((15, 15), dtype="int8") for i in range(4): grid[7][2+i] = 2 apple_pos = [7, 11] gr... Add solution -
Other 2021-10-19 09:27:07
how to change color of square in pygame with keypress
#Import statements are to enable the code to use the functions from the library import pygame import sys import os import random #instructions to windows to center the game window in the center of #the screen, which it might ignore os.environ["SDL_V... Add solution -
Python 2021-10-19 07:24:07
how to make a number guessing game in python
# updated version import random # for instructions so that the user understands def instructions(): print("Welcome to the guessing game you will have 3 tries to pick a number 1-10") print("Good luck btw it's all random") inst... Add solution -
Python 2021-10-18 03:18:11
python lottery 6 out of 49
import random correct = 0 total = 0 run = 1 howmany = int(input("How many correct guesses should there be? (0-6) ")) if howmany < 0: print("That was below 0.") quit() elif howmany > 6: print("That was over 6.&... Add solution
Best helpers
Ranking is empty