This file contains hidden or 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 PySimpleGUI as sg | |
layout = [ | |
[sg.Text("Enter the URL: ", font=('Arial, 16')), | |
sg.Input("", font=('Arial, 16'), size=(40, 1), key='url'), | |
sg.Button('Get Data', font=('Arial, 16'), key='get', bind_return_key=True)], | |
[sg.Multiline('', font=('Arial', 16), size=(70,15), key='output', disabled=True)] | |
] | |
This file contains hidden or 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 pgzrun | |
HEIGHT = 800 | |
WIDTH = 1000 | |
BLACK = (0, 0, 0) | |
ship = Actor("playership") | |
ship.x = WIDTH // 2 | |
ship.bottom = HEIGHT |
This file contains hidden or 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
""" | |
draw the ball | |
""" | |
import pgzrun | |
WIDTH = 1000 | |
HEIGHT = 700 | |
COLOUR = (0, 0, 250) | |
ball = Actor("ball") |
This file contains hidden or 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
''' | |
create_db.py - creates the table. | |
Note: This program should be run first to create the database and tables | |
''' | |
import sqlite3 | |
def create_table(): | |
sql_query = """ | |
CREATE TABLE tasks( |
This file contains hidden or 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
''' | |
create_db.py - creates the table. | |
Note: This program should be run first to create the database and tables | |
''' | |
import sqlite3 | |
def create_table(): | |
sql_query = """ | |
CREATE TABLE tasks( |
This file contains hidden or 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
""" | |
bot.py : Given an url, analyses the webpage and gives the following information about the page | |
1. Number of sentences in the webpage | |
2. Number of words in the page | |
3. Number of unique words in the page | |
4. 5 most frequent words in the page | |
""" | |
import PySimpleGUI as sg | |
from webutils import get_content_from_url, parse_html_by_tags |
This file contains hidden or 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 PySimpleGUI as sg | |
from webutils import get_html_content, parse_html_using_tag | |
from utils import get_statistics | |
layout = [ | |
[sg.Text("Web Page Analyzer", font=("Arial", 18))], | |
[sg.Text("Enter URL", font=("Arial", 14)), sg.InputText("", font=("Arial", 14), key='url'), | |
sg.Button("Get Data", font=("Arial", 14), key='get')], | |
[sg.Multiline("", font=("Arial", 14), size=(60, 15), key='output')] | |
] |
This file contains hidden or 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
""" | |
bot.py : Given a word, gets the meaning, synonyms and antonyms for the word | |
""" | |
import PySimpleGUI as sg | |
from utils import get_meaning | |
greeting = "Hi, I am a word bot. I can help you with words\n" | |
layout = [ | |
[sg.Multiline(greeting, font=("Arial", 14), size=(70, 15), key='output')], |
This file contains hidden or 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 file_write(fname, tasks): | |
with open(fname, "w") as fp: | |
for x in tasks: | |
fp.write("%s\n" % x) | |
def file_read(fname): | |
tasks = [] | |
try: | |
with open(fname, "r") as fp: |
This file contains hidden or 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
''' | |
program to read from a file using read() and write to another file using write() | |
''' | |
with open("input.txt","r") as reader: | |
lines = reader.read() | |
with open("output.txt","w") as writer: | |
writer.write(lines) |