For this analysis, i'll be using a Reddit API wrapper, called "praw", to loop through the /r/politics subreddit headlines. In [1]: from IPython import display import math from pprint import pprint import pandas as pd import numpy as np import nltk import matplotlib.pyplot as plt import seaborn as sns sns.set(style='darkgrid', context='talk', palette='Dark2') In [2]: """ For this … Continue reading Sentiment-analysis-Raddit-api
Tag: PYTHON
Coin Flip Simulation
Coin Flip Simulation - Write some code that simulates flipping a single coin however many times the user decides. The code should record the outcomes and count the number of tails and heads. """ Q: Coin Flip Simulation - Write some code that simulates flipping a single coin however many times the user decides. The … Continue reading Coin Flip Simulation
Calculator
Calculator - A simple calculator to do basic operators. Make it a scientific calculator for added complexity. """ Q: Calculator - A simple calculator to do basic operators. Make it a scientific calculator for added complexity. """ def calculator(a, b, op): if op not in '+-/*': return 'Please only type one of these characters: "+, … Continue reading Calculator
Binary to Decimal and Back Converter
Q: Binary to Decimal and Back Converter - Develop a converter to convert a decimal number to binary or a binary number to its decimal equivalent. """ Q: Binary to Decimal and Back Converter - Develop a converter to convert a decimal number to binary or a binary number to its decimal equivalent. """ # … Continue reading Binary to Decimal and Back Converter
Change Return Program
""" Q. Change Return Program - The user enters a cost and then the amount of money given. The program will figure out the change and the number of quarters, dimes, nickels, pennies needed for the change. """ #import math module import math def Change_Return_Program(denom,money): i = 0 used= [0]*len(denom) while(money >0):# go until all … Continue reading Change Return Program
Next Prime Number-Python
#Q. Next Prime Number - Have the program find prime numbers until the user chooses to stop asking for the next one. def is_prime(x): if x == 2: return True if x % 2 == 0: return False for i in range(3, int(x**0.5)+1, 2): if x % i == 0: return False return True def … Continue reading Next Prime Number-Python
SSL-Certificate-checker
import requests from bs4 import BeautifulSoup as bs import re url = "https://matlabhelpers.com/" page = requests.get(url) soup = bs(page.content , 'html.parser') head = soup.find('head') # re.findall(r'[^<]+', str(head)) #SSL secure ssl = soup.find(attrs={"rel": re.compile(r'canonical', re.I)}) # ssl['href'] if re.search('(https:)', ssl['href']): print('SSL Secure!!!') else: print('Bad news your website is not SSL secure')
Alarm Clock -Using Python
Alarm Clock - A simple clock where it plays a sound after X number of minutes/seconds or at a partic Code to make an Alarm clock using Python In [16]: #this module are pre installed with python import winsound, time, os, platform In [17]: def user_input(): """taking user input""" hour = int(input('Enter Hours: ')) minute = int(input('Enter … Continue reading Alarm Clock -Using Python
Language-filtered-tweet-Analysis
This blog will show the code with the help of which i've done sentiment analysis and also made an wordcloud after filtration of language. Applicable for all language. In [3]: import tweepy from tweepy import OAuthHandler import os import re In [5]: consumer_key = "--------------------------------" consumer_secret_key = "-------------------------------------" access_token = "-----------------------------------------------------" access_secret = "------------------------------------------" auth = OAuthHandler(consumer_key, … Continue reading Language-filtered-tweet-Analysis
Dictionaries in Python
We've been learning about sequences in Python but now we're going to switch gears and learn about mappings in Python. If you're familiar with other languages you can think of these Dictionaries as hash tables. This section will serve as a brief introduction to dictionaries and consist of: 1.) Constructing a Dictionary 2.) Accessing objects … Continue reading Dictionaries in Python
