This file contains hidden or 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: ")) | |
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 = "") |
This file contains hidden or 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
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}") |
This file contains hidden or 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 random import randint | |
from processing import * | |
numberOfParticules = 40; | |
position=[] | |
velocity=[] | |
lifespan=[] | |
color=1 | |
def setup(): |
This file contains hidden or 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 * | |
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) |
This file contains hidden or 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 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) | |
This file contains hidden or 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 | |
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'] |
This file contains hidden or 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 * | |
def stop(): | |
global running | |
running = False | |
def main(): | |
global running | |
clearscreen() | |
bgcolor("black") |
This file contains hidden or 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 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() |
This file contains hidden or 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
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) { |
This file contains hidden or 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
print_factors <- function(x) { | |
print(paste("The factors of",x,"are:")) | |
for(i in 1:x) { | |
if((x %% i) == 0) { | |
print(i) | |
} | |
} | |
} |