This file contains 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 urllib.request as req | |
from bs4 import BeautifulSoup | |
import pandas as pd | |
import xlwt.Workbook | |
# you have to understand the layout of the wikipedia page for this code. visit the site and inspect the page html code | |
# our goal is to extract the data form the web page and save the country name ,active cases etc, save them in a list | |
# and print the data in a tabular form using pandas and also write the data to a excel file | |
url = 'https://en.wikipedia.org/wiki/COVID-19_pandemic_by_country_and_territory' | |
html = req.urlopen(url) |
This file contains 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 urllib.request | |
from bs4 import BeautifulSoup | |
url = urllib.request.urlopen('https://www.mohfw.gov.in/') | |
soup = BeautifulSoup(url, 'html.parser') | |
cases = soup.findAll('li', class_= 'bg-blue') | |
active_cases = cases[0].strong.text | |
cured = soup.findAll('li', class_= 'bg-green') | |
discharged= cured[0].strong.text | |
deceased = soup.findAll('li', class_ = 'bg-red') |
This file contains 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 | |
print('''Winning Rules as follows : | |
Rock vs paper-> paper wins | |
Rock vs scissor-> Rock wins | |
paper vs scissor-> scissor wins. | |
''') | |
def user(): |
This file contains 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
def prime_number(n): | |
for n in range(2, n + 1): | |
if n > 1: | |
for y in range(2, n): | |
if n % y == 0: | |
break | |
else: | |
prime.append(n) | |
This file contains 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 string | |
import random | |
password_length = random.randint(10, 18) | |
print("password of length between 8 and 15 will be generated") | |
password = '' | |
while password_length > 0: | |
words_and_Digits = string.ascii_letters + string.digits + "!@#$%^&*()?_+*-" |
This file contains 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
# random number guessing game | |
# import random library | |
from random import randint | |
def user_name(): | |
name = str(input("what is your name?")) | |
return name.upper() | |
This file contains 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
''' | |
let's design the code for hangman. | |
''' | |
import time | |
import random | |
def secret_word(): |