This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
def typingErrors(prompt): | |
global iwords | |
words = prompt.split() | |
errors = 0 | |
for i in range(len(iwords)): | |
if i in (0, len(iwords)-1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from turtle import * | |
speed=0 | |
color('red', 'yellow') | |
begin_fill() | |
while True: | |
forward(200) | |
left(170) | |
if abs(pos()) < 1: | |
break | |
end_fill() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import string | |
def get_secure_password(length): | |
result_str = ''.join(random.choice(string.ascii_letters) for i in range(length)) | |
print(result_str) | |
get_secure_password(8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from turtle import * | |
class Disc(Turtle): | |
def __init__(self, n): | |
Turtle.__init__(self, shape="square", visible=False) | |
self.pu() | |
self.shapesize(1.5, n*1.5, 2) | |
self.fillcolor(n/6., 0, 1-n/6.) | |
self.st() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle; import random; import time | |
delay = 0.08 | |
score = 0 | |
high_score = 0 | |
wn = turtle.Screen() | |
wn.title("Snake Game") | |
wn.bgcolor("green") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import time | |
import random | |
snake_speed = 15 | |
window_x = 720 | |
window_y = 480 | |
black = pygame.Color(0, 0, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
import datetime | |
import time | |
import winsound | |
def alarm(set_alarm_timer): | |
while True: | |
time.sleep(1) | |
current_time = datetime.datetime.now() | |
now = current_time.strftime("%H:%M:%S") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
class Game: | |
screen = None | |
aliens = [] | |
rockets = [] | |
lost = False | |
def __init__(self, width, height): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def triangleShape(n): | |
for i in range(n): | |
for j in range(n-i): | |
print(' ', end=' ') | |
for k in range(2*i+1): | |
print('*',end=' ') | |
print() | |
def poleShape(n): | |
for i in range(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
row = int(input('Enter number of rows: ')) | |
number = 1 | |
print('\n') | |
for i in range(1,row+1): | |
for j in range(1, i+1): | |
print(number, end='\t') | |
number += 1 | |
print() |
OlderNewer