Skip to content

Instantly share code, notes, and snippets.

@CodeMaster7000
CodeMaster7000 / Pascal's Triangle.py
Created December 24, 2021 12:35
Pascal's Triangle in Python 3.
row = int(input("Enter number of rows: "))
space = 36
a = [0] * 20
print("\n\t\t\t\t PASCAL'S TRIANGLE\n")
for i in range(row):
for spi in range(1,space+1):
print(" ", end="")
a[i] = 1
for j in range(i+1):
print('%6d' %(a[j]), end = "")
@CodeMaster7000
CodeMaster7000 / Python Email Slicer.py
Created December 26, 2021 13:21
An email slicer built in Python 3.
email = input("Enter Your Email: ").strip()
username = email[:email.index('@')]
domain = email[email.index('@') + 1:]
print(f"Your username is {username} & your domain is {domain}")
@CodeMaster7000
CodeMaster7000 / Fireworks Sprinkler.py
Created December 29, 2021 15:17
A New Year fireworks sprinkler in Python 3.
from random import randint
from processing import *
numberOfParticules = 40;
position=[]
velocity=[]
lifespan=[]
color=1
def setup():
@CodeMaster7000
CodeMaster7000 / Fibonacci Spiral.py
Created December 29, 2021 22:34
A Fibonacci Spiral coded in Python 3 with Turtle.
from turtle import *
fibo_nr = [1,1,2,3, 5, 8, 13, 21, 34,55]
def draw_square(side_length):
for i in range(4):
forward(side_length)
right(90)
nr_squares=len(fibo_nr)
@CodeMaster7000
CodeMaster7000 / Magic 8 Ball.py
Created January 1, 2022 21:52
A Magic 8 Ball coded in Python 3 with the answers to all of your life questions!
import sys
import random
ans = True
while ans:
question = input("Ask our trustworthy Magic 8 ball a question: (press enter to quit) ")
answers = random.randint(1,20)
@CodeMaster7000
CodeMaster7000 / Story Generator.py
Created January 2, 2022 22:49
A random yet interesting story generator coded in Python 3.
import random
Sentence_starter = ['About 100 years ago', ' In the 20 BC', 'Once upon a time']
character = [' there lived a king.',' there was a man named Jack.',
' there lived a farmer.']
time = [' One day', ' One full-moon night']
story_plot = [' he was passing by',' he was going for a picnic to']
place = [' the mountains', ' the garden']
second_character = [' he saw a man', ' he saw a young lady']
age = [' who seemed to be in late 20s', ' who seemed very old and feeble']
@CodeMaster7000
CodeMaster7000 / Round Dance.py
Created January 8, 2022 11:49
A geometrically wonderful round dance coded in Python 3 with turtle.
from turtle import *
def stop():
global running
running = False
def main():
global running
clearscreen()
bgcolor("black")
@CodeMaster7000
CodeMaster7000 / Ball Catching Game.py
Last active January 20, 2022 20:02
A spectacular ball catching game coded in Python 3 with Tkinter.
from tkinter import Tk, Button, Label
from tkinter import Canvas
from random import randint
root = Tk()
root.title("Ball Catching Game")
root.resizable(False,False)
canvas = Canvas(root, width=600, height=600)
canvas.pack()
@CodeMaster7000
CodeMaster7000 / Simple Calculator.r
Created January 22, 2022 22:15
A simple calculator coded in R, performing the 4 basic functions.
add <- function(x, y) {
return(x + y)
}
subtract <- function(x, y) {
return(x - y)
}
multiply <- function(x, y) {
return(x * y)
}
divide <- function(x, y) {
@CodeMaster7000
CodeMaster7000 / Factor Finder.r
Created January 22, 2022 22:17
A program in R to find the factors of a given number.
print_factors <- function(x) {
print(paste("The factors of",x,"are:"))
for(i in 1:x) {
if((x %% i) == 0) {
print(i)
}
}
}