For the following quiz questions, we will get a preview of comparison operators. In the table below, a=3 and b=4. Operator Description Example == If the values of two operands are equal, then the condition becomes true. (a == b) is not true. != If values of two operands are not equal, then condition becomes … Continue reading Booleans in Python(Comparison operators)
FUNCTION IN PYTHON
Functions are block of codes that are designed to perform specific task .In this chapter you will study everything about function. If you have to perform a task multiple times throughout, so instead of writing code again and again you can define a function for this task and can call that function whenever we want … Continue reading FUNCTION IN PYTHON
Errors and Exception Handling
In this blog we will learn about Errors and Exception Handling in Python. You've definitely already encountered errors by this point in the course. For example: Note how we get a Syntax Error, with the further description that it was an EOL (End of Line Error) while scanning the string literal. This is specific enough … Continue reading Errors and Exception Handling
DATA TYPES IN PYTHON
Since everything is object in python programming, So every values in python has a data type.The various data types in python are: Numbers. List. Tuples. Strings Set Dictionary 1.Numbers In python numbers are categorized as : Int (ex: 3, 4, 5 , …) Float (ex: 3.0, 4.0, 5.0 , …) Complex (ex:1+2j, 2+3j , 2+5j, … Continue reading DATA TYPES IN PYTHON
Tuples
In Python tuples are very similar to lists, however, unlike lists they are immutable meaning they can not be changed. You would use tuples to present things that shouldn't be changed, such as days of the week, or dates on a calendar. You'll have an intuition of how to use tuples based on what you've … Continue reading Tuples
Comparison Operators in PYTHON
These operators will allow us to compare variables and output a Boolean value (True or False). If you have any sort of background in Math, these operators should be very straight forward. Table of Comparison Operators: Operator Description Example == If the values of two operands are equal, then the condition becomes true. (a == … Continue reading Comparison Operators in PYTHON
Sentiment-analysis-Raddit-api
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
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')
Data Visualization-II (Python)
# Data-visualization-2 In the second part of data visualization,Almost all the plot in this repo is drawn using "Seaborn" library: >The boxplot is drawn with the randomely generated data, >Data visualization of the iris data is also show >Reg plot is also drawn >lmplot is also ploted >And also you will learn how to make … Continue reading Data Visualization-II (Python)
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
map()
map() is a built-in Python function that takes in two or more arguments: a function and one or more iterables, in the form: map(function, iterable, ...) map() returns an iterator - that is, map() returns a special object that yields one result at a time as needed. We will learn more about iterators and generators … Continue reading map()