This is a user-friendly Hangman game. I was working on it for three weeks.

https://repl.it/@BYLDOG/hangman
print("Starting a game of Hangman.") from random import randint valid1 = 0 x = 0 hg = 0 valid2 = 0 valid27000 = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ] valid30 = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25" ] valid900 = ["3", "4", "5", "6", "7", "8", "9", "10"] allwords = [ "dog", "cat", "man", "woman", "drums", "cousin", "brother", "epidemic", "pencilcase" ] y = len(allwords) validwords = [] while valid1 == 0: attempts = input("How many incorrect attempts do you want? [1-25] ") if attempts not in valid30: print("Not a valid number from 1 to 25") else: valid1 = 1 attempts = int(attempts) while valid2 == 0: minlen = input("What's the minimum length of the word? [3-10] ") if minlen not in valid900: print("Not a valid number from 3 to 10") else: valid2 = 1 minlen = int(minlen) while x in range(-1, y - 1): x = x + 1 lenx = int(len(allwords[x])) valid3 = max(lenx, minlen) if valid3 == lenx: validwords.append(allwords[x]) wordnm = randint(0, len(validwords) - 1) word = validwords[wordnm] wordlen = len(word) guess = [] wordlist = [] for x in range(0, wordlen): x = x + 1 guess.append("*") wordlist.append(word[x - 1]) while attempts > 0: print(guess) guess1 = input("Enter your guess: ") if guess1 not in valid27000: print( "This is not a valid guess. Try inputting a lowercase English letter" ) else: if guess1 not in wordlist: if attempts != 1: print("This letter is not in the word. Try again") else: print( "This letter is not in the word. You have ran out of attempts." ) attempts = attempts - 1 else: print("This letter is in the word") while hg in range(0, len(wordlist)): if wordlist[hg] == guess1: guess[hg] = guess1 hg = hg + 1 if guess == wordlist: print("You won! Congrats. The word is " + word) while True: aohuni = 1 hg = 0

Update For Code On Web Scraper

I accidentally forgot to include a filter for prices, here's the updated code.

""" Copyright Adam Blumenfeld All rights reserved """ # These are the variable you have to set Email = "email@example.com" Password = "examplepassword" # Imports import requests from bs4 import BeautifulSoup import smtplib import time import datetime import keyboard as k import sys wait = True def wait_false(): global wait wait = False k.add_hotkey("ctrl+g", lambda: wait_false()) # URLS you want to check URLS = ["https://www.amazon.com/Lysol-Bathroom-Cleaner-Island-Breeze/dp/B06ZZQSH77/ref=sr_1_5?dchild=1&keywords=lysol+spray&qid=1588110272&sr=8-5", "https://www.amazon.com/Lysol-Disinfectant-Spray-Morning-Breeze/dp/B01IAIMYF2/ref=sr_1_1?dchild=1&keywords=lysol+disinfectant&qid=1588133936&sr=8-1", "https://www.amazon.com/Scott-67805-Recycled-Bathroom-Tissue/dp/B0040ZOIZO/ref=pd_ybh_a_5?_encoding=UTF8&psc=1&refRID=Y73XTT0K4CR1PQMFPV3V", "https://www.amazon.com/AmScope-120X-1200X-M30-ABS-KT2-W-Beginner-Microscope/dp/B00GGY85EC/ref=sr_1_1?dchild=1&keywords=microscope&qid=1588207972&s=industrial&sr=1-1"] # Time you want to space out already made emails (If you want to never relese emails on an item again, set it to float('inf')) cooldown_time = 7200 headers = { "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36'} def check(URL, maillist): page = requests.get(URL, headers=headers) soup1 = BeautifulSoup(page.content, 'html.parser') soup = BeautifulSoup(soup1.prettify(), "html.parser") title = soup.find(id="productTitle").get_text().strip().split(',')[0] available = soup.find(id="availability") price = soup.find(id="priceblock_ourprice") if price != None: print("Product is available") send_mail(title, URL, maillist) return True if available == None: print("Product is available") send_mail(title, URL) return True available = available.findChild('span').get_text().strip()[0:15] if available == "Temporarily out": print("Product is available") send_mail(title, URL, maillist) return True print("Product isn't available") return False def send_mail(title, link, maillist): global email global password server = smtplib.SMTP('smtp.gmail.com', 587) server.ehlo() server.starttls() server.ehlo() server.login(email, password) subject = f'"{title}" is available!' body = f'Check the Amazon link to see availablility: {link}' msg = f"Subject: {subject}\n\n{body}" server.sendmail( email, maillist, msg ) print('Email Has Been Sent!') server.quit() wait = True cooldown = {} # The time you want between checks time_between_checks = 120 while True: print("Press CTRL+g to fast forward check") i = 0 while i < time_between_checks and wait: time.sleep(1) print("Time since last check:", i, "\\", time_between_checks, end="\r") i += 1 wait = True print("\n") for URL in URLS: time_ = datetime.datetime.now() print(f"Checking... <{time_}> <{URL}>\n") if cooldown.get(URL) != None: if time.time() - cooldown[URL] >= cooldown_time: del cooldown[URL] else: print(f"Cooldown time for URL <{URL}>: {cooldown_time-int((time.time() - cooldown[URL]) % 60)} seconds") continue availability = check(URL, sys.argv) if availability: cooldown[URL] = time.time() print("\n\n")

Web Scraper For Amazon Availibility

This web scraper checks amazon links by URL every two minutes, and emails you when those products are available. There is a cooldown of 4 hours for products that have been found available and emailed to you, but this cooldown only affects the particular item and not all of the URLs. By the way these parameters are completely customizable (you can have your wait time be 5 minutes, your cooldown be infinite, etc.) I made this scraper to help people out with panic buying and the lowered availability of basic items. In my original program, I made an email called amazonbot100@gmail.com to carry out the emails. To set up an email with this program, here are the steps: 1. Create a new email (Recommended, but not required) 2. Enable two-factor authentication for your account (This is required for the next step) 3. Set up App Passwords for your account and create a new one for your computer. 4. Paste in the email address to the Email variable at the top, and paste the app password into the Password variable under that. 4.5. Search up "my user agent" on google and paste it into the user agent 5. Run python -m pip install bs4 6. Run python -m pip install requests 7. Run python -m pip install keyboard Also, I understand that the code isn't the most efficient, especially towards the end, though I was in a rush so don't judge me xD. Usage: python scraper.py email-to-send-1@example.com email-to-send-2@example.com email-to-send-3@example.com email-to-send-you-get-the-point@example.com

""" Copyright Adam Blumenfeld All rights reserved """ # These are the variable you have to set Email = "email@example.com" Password = "examplepassword" # Imports import requests from bs4 import BeautifulSoup import smtplib import time import datetime import keyboard as k import sys wait = True def wait_false(): global wait wait = False k.add_hotkey("ctrl+g", lambda: wait_false()) # URLS you want to check URLS = ["https://www.amazon.com/Lysol-Bathroom-Cleaner-Island-Breeze/dp/B06ZZQSH77/ref=sr_1_5?dchild=1&keywords=lysol+spray&qid=1588110272&sr=8-5", "https://www.amazon.com/Lysol-Disinfectant-Spray-Morning-Breeze/dp/B01IAIMYF2/ref=sr_1_1?dchild=1&keywords=lysol+disinfectant&qid=1588133936&sr=8-1", "https://www.amazon.com/Scott-67805-Recycled-Bathroom-Tissue/dp/B0040ZOIZO/ref=pd_ybh_a_5?_encoding=UTF8&psc=1&refRID=Y73XTT0K4CR1PQMFPV3V", "https://www.amazon.com/AmScope-120X-1200X-M30-ABS-KT2-W-Beginner-Microscope/dp/B00GGY85EC/ref=sr_1_1?dchild=1&keywords=microscope&qid=1588207972&s=industrial&sr=1-1"] # Time you want to space out already made emails (If you want to never relese emails on an item again, set it to float('inf')) cooldown_time = 7200 headers = { "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36'} def check(URL, maillist): page = requests.get(URL, headers=headers) soup1 = BeautifulSoup(page.content, 'html.parser') soup = BeautifulSoup(soup1.prettify(), "html.parser") title = soup.find(id="productTitle").get_text().strip().split(',')[0] available = soup.find(id="availability") if available == None: print("Product is available") send_mail(title, URL) return True available = available.findChild('span').get_text().strip()[0:15] if available == "Temporarily out": print("Product is available") send_mail(title, URL, maillist) return True print("Product isn't available") return False def send_mail(title, link, maillist): global email global password server = smtplib.SMTP('smtp.gmail.com', 587) server.ehlo() server.starttls() server.ehlo() server.login(email, password) subject = f'"{title}" is available!' body = f'Check the Amazon link to see availablility: {link}' msg = f"Subject: {subject}\n\n{body}" server.sendmail( email, maillist, msg ) print('Email Has Been Sent!') server.quit() wait = True cooldown = {} # The time you want between checks time_between_checks = 120 while True: print("Press CTRL+g to fast forward check") i = 0 while i < time_between_checks and wait: time.sleep(1) print("Time since last check:", i, "\\", time_between_checks, end="\r") i += 1 wait = True print("\n") for URL in URLS: time_ = datetime.datetime.now() print(f"Checking... <{time_}> <{URL}>\n") if cooldown.get(URL) != None: if time.time() - cooldown[URL] >= cooldown_time: del cooldown[URL] else: print(f"Cooldown time for URL <{URL}>: {cooldown_time-int((time.time() - cooldown[URL]) % 60)} seconds") continue availability = check(URL, sys.argv) if availability: cooldown[URL] = time.time() print("\n\n")

Simple Imperial to Metric Converter//Temperature

This converter is written on Python and with it, you can convert any Fahrenheit measurement to Celsius.

https://repl.it/@BYLDOG/OldfashionedAquaOpen64
fdegrees=int(input("Enter the value in degrees Farenheit: ")) cdegrees1=fdegrees-32 cdegrees=cdegrees1/1.8 print("Your value in degrees Celsius is "+str(cdegrees))

Simple Metric to Imperial Converter//Weight

This converter is written on Python and with it, you can convert any metric measurement to pounds or ounces.

https://repl.it/@BYLDOG/RigidUnrealisticMacro
amount=int(input("How many? ")) msrmnt=input("What measurement(kg or g)? ") cvt=input("Convert to what(lb or oz)? ") if msrmnt=="kg": if cvt=="lb": print(amount*2.2) if cvt=="oz": print(amount*35.3) if msrmnt=="g": if cvt=="lb": print(amount/454) if cvt=="oz": print(amount/28)

Guessing Game

This is a Guessing game where you are supposed to use a while loop. In this game, While loops can be used to cycle through your code until you get the correct number.

Linear Regression with Multiple Variables


x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] y = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] z = [1, 8, 27, 64, 125, 216, 343, 512, 729, 1000] def SlopeD1(x, y, z, slope1, slope2, yInt): length = len(x) total = 0 for i in range(length): predicted = (slope1 * x[i]) + (slope2 * y[i]) + yInt difference = (z[i] - predicted) * x[i] total += difference returnValue = (-2/length) * total return returnValue def SlopeD2(x, y, z, slope1, slope2, yInt): length = len(x) total = 0 for i in range(length): predicted = (slope1 * x[i]) + (slope2 * y[i]) + yInt difference = (z[i] - predicted) * y[i] total += difference returnValue = (-2/length) * total return returnValue def InterceptD(x, y, z, slope1, slope2, yInt): length = len(x) total = 0 for i in range(length): predicted = (slope1 * x[i]) + (slope2 *y[1]) + yInt difference = (z[i] - predicted) total += difference returnValue = (-2/length) * total return returnValue m1 = 0 m2 = 0 c = 0 l = 0.000001 iterations = 99999 for i in range(iterations): mm1 = SlopeD1(x, y, z, m1, m2 ,c) mm2 = SlopeD2(x, y, z, m1, m2 ,c) yint = InterceptD(x, y, z, m1, m2 ,c) m1 = m1 - (l * mm1) m2 = m2 - (l * mm2) c = c - (l * yint) #print(m1, m2, c) print ('(', end ='' ) print(m1, end=', ') print(m2, end=', ') print(c, end=')')

Linear Regression


x = [1, 5, 3, 4, 7, 9, 12, 13, 15, 16, 17, 4, 5, 2, 10, 23, 25] y = [5, 12, 23, 14, 17, 8, 20, 21, 25, 38, 42, 10, 13, 7, 23, 50, 55] def SlopeD(x, y, slope, yInt): length = len(x) total = 0 for i in range(length): predicted = (slope * x[i]) + yInt difference = (y[i] - predicted) * x[i] total += difference returnValue = (-2/length) * total return returnValue def InterceptD(x, y, slope, yInt): length = len(x) total = 0 for i in range(length): predicted = (slope * x[i]) + yInt difference = (y[i] - predicted) total += difference returnValue = (-2/length) * total return returnValue m = 0 c = 0 l = 0.000001 iterations = 99999 for i in range(iterations): slope = SlopeD(x, y, m ,c) intercept = InterceptD(x, y, m ,c) m = m - (l * slope) c = c - (l * intercept) print (m, c)

Naive Bayes Algorithm

This is a program demonstrating the Naive Bayes Algorithm. It is used to see if it will be a good day to golf.



import math #set up the predone data outlook = ['sunny','sunny','overcast','rainy','rainy','rainy','overcast','sunny', 'sunny','rainy','sunny','overcast','overcast','rainy'] temperature = ['hot','hot','hot','mild','cool','cool','cool','mild','cool', 'mild','mild','mild','hot','mild'] humidity = ['high','high','high','high','normal','normal','normal','high', 'normal','normal','normal','high','normal','high'] windy = ['false','true','false','false','false','true','true','false','false', 'false','true','true','false','true'] play = ['no','no','yes','yes','yes','no','yes','no','yes','yes','yes','yes', 'yes','no'] print("Hi welcome to the Naive Bayes Algorithm which will help calculate if it will be a good day to golf!") print("This program has some preset data that will be inputted into the algorithm""\n") #need sunny,cool,high humidity,strong wind, and play yes yescount = 0 nocount = 0 #finds the amount of days you can play golf and bad days to play golf out the the amount of days tested def findyes(): no = 0 yes = 0 for x in range(len(play)): if play[x] == 'no': no += 1 else: yes += 1 global yescount yescount += yes global nocount nocount += no print("There were", yes ,"/", len(play),"days you could golf on and","There were", no,"/",len(play),"days you couldn't golf on") findyes() yeshumid = 0 yessunny = 0 yescool = 0 yeswind = 0 ''' This is a function that helps determine the amount of humid, sunny, cool, and windy days out of the days that it was good to gold ''' def yescalculator(): highhumidity = 0 sunny = 0 cool = 0 wind = 0 for x in range(len(play)): if play[x] == 'yes': if outlook[x] == 'sunny': sunny += 1 if temperature[x] == 'cool': cool += 1 if humidity[x] == 'high': highhumidity += 1 if windy[x] == 'true': wind += 1 global yeshumid yeshumid += highhumidity global yessunny yessunny += sunny global yescool yescool += cool global yeswind yeswind += wind nohumid = 0 nosunny = 0 nocool = 0 nowind = 0 ''' This function helps determine the amount of sunny, humid, cool, a windy days bad golf days ''' def nocalculator(): sunny = 0 cool = 0 wind = 0 highhumidity = 0 for x in range(len(play)): if play[x] == 'no': if outlook[x] == 'sunny': sunny += 1 if temperature[x] == 'cool': cool += 1 if humidity[x] == 'high': highhumidity += 1 if windy[x] == 'true': wind += 1 global nohumid nohumid += highhumidity global nosunny nosunny += sunny global nocool nocool += cool global nowind nowind += wind yescalculator() nocalculator() print("\n""Probability we can play the game:") print("Probability of it being a good golf day and sunny is" ,yessunny,"/",yescount) print("Probability of it being a good golf day and cool is" ,yescool,"/",yescount) print("Probability of it being a good golf day and humid is" ,yeshumid,"/",yescount) print("Probability of it being a good golf day and windy is" ,yeswind,"/",yescount,"\n") print("Probability we cannot play a game:") print("Probability of it being a stay home day and sunny is",nosunny,"/",nocount) print("Probability of it being a stay home day and sunny is",nocool,"/",nocount) print("Probability of it being a stay home day and sunny is",nohumid,"/",nocount) print("Probability of it being a stay home day and sunny is",nowind,"/",nocount) #calculate evidence P(x) of the equation which is denominator evidences = 0 def findevidence(): evidence = (((yeshumid + nohumid)/14)*((yessunny + nosunny)/14)*((yeswind+nowind)/14)*((yescool + nocool)/14)) global evidences evidences += evidence findevidence() ''' this function multiplies all the no probabilities and yes probabilities and compares to see if it will be a good day to golf or a good day to stay home and watch a movie ''' def compare(): yesequation = (((yessunny/yescount)*(yeshumid/yescount)*(yeswind/yescount)*(yescool/yescount)*(yescount/len(play)))/evidences) noequation = (((nosunny/nocount)*(nohumid/nocount)*(nowind/nocount)*(nocool/nocount)*(nocount/len(play)))/evidences) print("\n""The probability it will be a good day is", yesequation) print("The probability it will be a bad day is", noequation) if yesequation > noequation: print("\n""There is higher probability it will be a good day for golf.","Let's go play some!") else: print("\n""There is a higher probability it will be a bad day for golf.","Lets go watch a movie!") compare()

Hangman

I made a program for Hangman, where the user is given 5 wrong letters to try to guess the random word.


import random wordbank = ["dinosaur","peanut","pencil","apple","pineapple"] separatedword = [] usedletters = [] #chooses a word from the list randomly random = random.randint(0,4) word = wordbank[random] guesses = 0 amountwrong = 5 wrong = "true" #welcomes user print("Hi welcome to Royce's Hangman Game" "\n" "Rule include: you have 5 wrong guesses", "Good Luck :)") #function to check if the user has already guessed the letter def guesscheck(userguesses): for x in range(len(usedletters)): if userguesses == usedletters[x]: print("oops you have already guessed that letter") global userguess userguess = input("\n" "Guess a letter") #separates the word up into a list by letter def separateword(): for x in range(0,len(word),1): separatedword.append(word[x]) separateword() letterleft = len(separatedword) length = len(separatedword) print("For testing purposes I'm including the random word" , word) print("The random word is", letterleft, "letters long") ''' loop to see if they can guess the word as long as the player hasn't run out of turns or has guessed it the loop will continue ''' while amountwrong != 0 and letterleft != 0: #asks user for a letter userguess = input("\n""Guess a letter") if guesses >= 1: guesscheck(userguess) #iterates through the list and checks to see if the guessed letter is in the #word for x in range(0,length,1): if userguess == separatedword[x]: print("You got the letter right!", "The word had a(n)",userguess) letterleft -= 1 wrong = "false" usedletters.append(userguess) guesses += 1 ''' uses a true or false to determine if the user has guessed wrong if true then it takes away a chance and tells the user ''' if wrong == "true": amountwrong -=1 print("oops that letter isn't in the word try again") #if not then it just continues and prints out the stats else: wrong = "true" print("You can still get" , amountwrong, "wrong" ) print("There are still", letterleft, "letters left to guess") #end of game print("\n" "You took an amount of",guesses,"guesses") if amountwrong == 0: print("Too bad you lost all your chances. Better luck next time!") else: print("Congrats! you guessed the word!", "The word was",word)

K Means Clustering

This program first assigns initial clusters to a set of data. It then takes the mean of each of these clusters and then uses them to make new clusters. If the new cluster is the same as the previous loop's cluster then the program ends.


import math import random same = "false" counter = 1 print("Hi welcome to my K Means Cluster program") #select value of K kvalue = int(input('What value of K?')) #endless loop until clusters are set while same != "true": clusterpoints = [(2,0),(2.3,0),(2.5,0),(2.7,0),(2.9,0),(2.2,0) ,(3.1,0),(3.3,0),(3.4,0),(3.6,0),(3.9,0),(3.2,0) ,(4,0),(4.5,0),(4.1,0),(4.3,0),(4.7,0),(4.5,0)] referencepoints = [] red = [] blue = [] yellow = [] #select 3 points if counter == 1: for x in range(0,kvalue,1): points = random.randint(0,15) if x == 1: red.append(clusterpoints[points]) clusterpoints.remove(clusterpoints[points]) elif x == 2: blue.append(clusterpoints[points]) clusterpoints.remove(clusterpoints[points]) else: yellow.append(clusterpoints[points]) clusterpoints.remove(clusterpoints[points]) #after the first loop it now uses the mean as a point to determine clusters if counter > 1 : red.append((findmean(previousred),0)) blue.append((findmean(previousblue),0)) yellow.append((findmean(previousyellow),0)) reddistances = [] bluedistances = [] yellowdistances = [] #function for calculating the distances def distancecalculator(color, list): for x in range(len(clusterpoints)): first = clusterpoints[x] firstvalue = first[0] secondvalue = first[1] distance = math.sqrt(((firstvalue-color[0][0])**2)+((secondvalue-color[0][1])**2)) list.append(distance) distance = 0 distancecalculator(red, reddistances) distancecalculator(blue, bluedistances) distancecalculator(yellow, yellowdistances) #assign each point to the nearest cluster placeholder1 = 0 placeholder2 = 0 placeholder3 = 0 for x in range(0,len(clusterpoints),1): placeholder1 = reddistances[x] placeholder2 = bluedistances[x] placeholder3 = yellowdistances[x] if placeholder1 < placeholder2 and placeholder1 < placeholder3: red.append(clusterpoints[x]) elif placeholder2 < placeholder3 and placeholder2 < placeholder1: blue.append(clusterpoints[x]) elif placeholder3 < placeholder2 and placeholder3 < placeholder1: yellow.append(clusterpoints[x]) #removes reference point red.pop(0) blue.pop(0) yellow.pop(0) #This is for the breaking of the loop. It checks to see if all three clusters are the same endcounter = 0 if counter > 1: if (sorted(red)==sorted(previousred)): endcounter +=1 if (sorted(red)==sorted(previousred)): endcounter +=1 if (sorted(red)==sorted(previousred)): endcounter +=1 #if all 3 clusters are same as previous loop then end code if endcounter == 3: print("\n""This is the previous clusters","\n""red",previousred,"\n""blue",previousblue,"\n""yellow",previousyellow) print("\n""This is the cluster on the next loop","\n""red",red,"\n""blue",blue,"\n""yellow",yellow) print("\n""Since they are the same, the clusters are set") print("The clusters were set in", counter, "loops") same = "true" #This is a variable that is used to keep the previous clusters previousred = red previousblue = blue previousyellow = yellow #find mean of each cluster and do the process again def findmean(list): adder = 0 for x in range(len(list)): adder += list[x][0] meanvalue = adder/len(list) return meanvalue counter+=1

Correlation Coefficient

A program that finds the correlation coefficient of two security companies(SPY and JPM) over a year and how each affect each other.


SPY=[170.66,170.95,170.70,169.73,169.18,169.80,169.31,169.11,169.61,168.74,166.38,165.83] JPM=[56.54,56.40,56.10,55.49,55.30,54.83,54.52,54.09,54.29,54.15,53.29,51.83] SPYsq=[170.66**2,170.95**2,170.70**2,169.73**2,169.18**2,169.80**2,169.31**2,169.11**2,169.61**2,168.74**2,166.38**2,165.83**2] JPMsq=[56.54**2,56.40**2,56.10**2,55.49**2,55.30**2,54.83**2,54.52**2,54.09**2,54.29**2,54.15**2,53.29**2,51.83**2] SPYxJPM=[170.66*56.54,170.95*56.40,170.70*56.10,169.73*55.49,169.18*55.30,169.80*54.83,169.31*54.52,169.11*54.09,169.61*54.29,168.74*54.15,166.38*53.29,165.83*51.83] avSPY=sum(SPY)/12 avJPM=sum(JPM)/12 avSPYsq=sum(SPYsq)/12 avJPMsq=sum(JPMsq)/12 avSPYxJPM=sum(SPYxJPM)/12 SPYvariance=avSPYsq-(avSPY*avSPY) JPMvariance=avJPMsq-(avJPM*avJPM) covariance=(avSPYxJPM)-(avSPY*avJPM) correlation_coefficient=covariance/math.sqrt(SPYvariance*JPMvariance) print('Welcome to this program, this will help you see the correlation coefficient of the sucurity companies SPY and JPM.') print ('Here is the Data for SPY:',SPY) print ('Here is the Data for JPM:',JPM) print('According to the Data the correlation coefficient is:',correlation_coefficient,'or about 93%')
Myles Brooks Jun 28

nice work

1 2 ... 5