## Blog Pages

### BMI Calculator Using Python

height = float(input("Enter height in foot"))

height_in_meter = height*12/39.37

weight = int(input("Enter weight in kg"))

BMI = weight/pow(height_in_meter,2)

print("BMI:-",BMI)

if BMI > 25:

print("Overweight")

elif BMI < 18:

print("Underweight")

else:

print("Fit")

### Python script that takes the city name and returns the weather information of that city using web scraping

from bs4 import BeautifulSoup

import requests

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}

def weather(city):

city=city.replace(" ","+")

soup = BeautifulSoup(res.text,'html.parser')

location = soup.select('#wob_loc')[0].getText().strip()

time = soup.select('#wob_dts')[0].getText().strip()

info = soup.select('#wob_dc')[0].getText().strip()

weather = soup.select('#wob_tm')[0].getText().strip()

print(location)

print(time)

print(info)

print(weather+"°C")

print("enter the city name")

city=input()

city=city+" weather"

weather(city)

### Create Graph Using Python

import matplotlib.pyplot as plt

import numpy as np

xpoints = np.array([1,8])

ypoints = np.array([3,10])

plt.plot(xpoints,ypoints)

plt.show()

### Drawing Corona Virus Using Turtle

from turtle import *

color('green')

bgcolor('black')

speed(10)

hideturtle()

b = 0

while b < 200:

right( b)

forward(b * 3)

b = b + 1

### Program to draw pie chart in python

import matplotlib.pyplot as plt

x=[30,30,20,20]

labeks=["Python","Java","C","C++"]

plt.pie(x,labels=labeks)

plt.show()

### PROGRAM TO CREATE INSTAGRAM LOGO IN PYTHON TURTLE

from turtle import  *

speed(5)

def om(x,y):

penup()

goto(x,y)

pendown()

def om1(x,y,f,c,c1,c2):

color(c)

om(x,y)

begin_fill()

for i in range(4):

forward(f)

circle(c1,c2)

end_fill()

def om2(c,x,y,c1):

color(c)

begin_fill()

om(x, y)

circle(c1)

end_fill()

om1(-150,-120,350,"black",20,90)

om1(-110,-70,260,"white",20,90)

om1(-90,-50,220,"black",20,90)

om2("white",20,10,70)

om2("black",20,30,50)

om2("white",110,160,15)

color("black")

om(-120,-180)

write("INSTAGRAM",font=("Helvetica",40,"bold"))

hideturtle()

done()

### Plotting Star Using Turtle

import turtle

s = turtle.Turtle()

s.right(75)

s.forward(100)

for i in range(4):

s.right(144)

s.forward(100)

turtle.done()

### program to sort a list of tuples by second Item

def Sort_Tuple(tup):

lst = len(tup)

for i in range(0, lst):

for j in range(0, lst-i-1):

if (tup[j][1] > tup[j + 1][1]):

temp = tup[j]

tup[j]= tup[j + 1]

tup[j + 1]= temp

return tup

tup =[('for', 24), ('for', 10), ('programming', 28),

('python', 5), ('solution', 20), ('engineers', 15)]

print(Sort_Tuple(tup))

### Colorful Spiral Web Using Turtle Graphics in Python

import turtle

colors = ['red', 'yellow', 'green', 'purple', 'blue', 'orange']

s= turtle.Pen()

s.speed(10)

turtle.bgcolor("black")

for x in range(200):

s.pencolor(colors[x%6])

s.width(x/100 + 1)

s.forward(x)

s.left(59)

turtle.done()

s.speed(20)

turtle.bgcolor("black")

for x in range(200):

s.pencolor(colors[x%6])

s.width(x/100 + 1)

s.forward(x)

s.left(59)

turtle.done()

### Remove all duplicates words from a given sentence

from collections import Counter

def remov_duplicates(input):

input = input.split(" ")

for i in range(0, len(input)):

input[i] = "".join(input[i])

Uniq = Counter(input)

s = " ".join(Uniq.keys())

print (s)

if __name__ == "__main__":

input = 'Python is great and Java is also great'

remov_duplicates(input)