Skip to main content

simple Calculator

Project description

versarfeafaef #1.

def html_tag(tag): def wrap_text(msg): print('<{0}>{1}</{0}>'.format(tag, msg))

return wrap_text

print_h1 = html_tag('h1') print_h1('btuAI ') print_h1('TeslaAI') print_p = html_tag('p') print_p('PythonAi')

from flask import Flask

app = Flask(name) courses = [ {'Description': 'Python in AI', 'course_id': 0, 'name': 'Python AI Certificate', 'site': 'btu.edu.ge' }, { 'Description': 'CCNA', 'course_id': 1, 'name': 'CCNA Certificate', 'site': 'netacad.com' }, {'Description': 'Linux', 'course_id': 2, 'name': 'Linux Certificate', 'site': 'netdevgroup.com' } ]

@app.route("/") def main(): return "hello"

@app.route('/courses/int:course_id') def coursese(course_id): return courses[course_id]

@app.route('/courses/int:course_id', methods=['PUT']) def update(course_id): courses[course_id]['Description'] = 'BTU DESCRIPTION' return courses[course_id]

if name == "main": app.run(debug=True)

curl -X PUT http://127.0.0.1:5000/courses/1

from flask import Flask import dataset

app = Flask(name) db = dataset.connect('sqlite:///database1412.db') books = { '1': { "id": "1", "name": "Elon Musk", "author": "Ashlee Vance" }, '2': { "id": "2", "name": "Steve Jobs", "author": "Walter Isaacson" } } table = db['books'] table.insert({ "book_id": "1", "name": "Elon Musk", "author": "Ashlee Vance" }) table.insert({ "book_id": "2", "name": "Steve Jobs", "author": "Walter Isaacson" })

@app.route('/') def api_books(): return books

if name == 'main': app.run()

from flask import Flask

app = Flask(name) courses = [{ 'Description': 'Python in AI', 'course_id': 0, 'name': 'Python AI Certificate', 'site': 'btu.edu.ge'

}, {'Description': 'CCNA', 'course_id': 1, 'name': ' CCNA Certificate', 'site': 'netacad.com'}, {'Description': 'Linux', 'course_id': 2, 'name': 'Linux Certificate', 'site': 'netdevgroup.com'} ]

@app.route("/") def show(): return courses

@app.route("/int:course_id", methods=['DELETE']) def delete(course_id): courses.remove(courses[course_id]) return courses

if name == "main": app.run(debug=True)

curl - X DELETE http: // 127.0 .0 .1: 5000 / 1

import sqlite3

db = sqlite3.connect("databaseSQL.sqlite3") list = [(1997, "GTA", 'New Guernsey'), (1999, "GTA", "USA"), (2001, "GTA III", "Liberty City"), (2002, "GTA:Vice City", "Vice City"), (2004, "GTA: San Andreas", "San Andreas"), (2008, "GTA IV", "Liberty City") ] cursor = db.cursor( ) cursor.execute('''create table if not exists gta(year INTEGER, game text, city text)''') cursor.executemany("insert into gta values(?,?,?)", list) cursor.execute("""create table if not exists city(gta_city text,real_city text)""") listmeore = [("Liberty City", "New York")] cursor.executemany("insert into city values (?,?)", listmeore) cursor.execute("""update gta set city = 'New York' where city='Liberty City'""") cursor.execute("""update city set real_city ='New York' where gta_city ='Liberty City'""") cursor.execute("""select * from gta where city is not 'New York'""") notnewyork = cursor.fetchall() print(notnewyork) db.commit() db.close()

def outer_func(): message = 'Python'

def inner_func():
    print(message)

return inner_func

def outerFunction(text): def innerFunction(): print(text)

return innerFunction

a = outerFunction('Tesla') a()

7 import requests from bs4 import BeautifulSoup

url = 'https://realpython.github.io/fake-jobs/' html = requests.get(url) tesla = BeautifulSoup(html.content, 'html.parser') results = tesla.find(id='ResultsContainer') job_title = results.find_all('h2', class_='title is-5') for job in job_title: print(job.text)

8

from flask import Flask

app = Flask("name") dicto = [{ 'Description': 'Python in AI', 'course_id': 0, 'name': 'Python AI Certificate', 'site': 'btu.edu.ge' }, {'Description': 'CCNA', 'course_id': 1, 'name': 'CCNA Certificate', 'site': 'netacad.com' }, { 'Description': 'Linux', 'course_id': 2, 'name': 'Linux Certificate', 'site': 'netdevgroup.com' }]

dasamatebeli = { 'Description': 'SQLserver', 'course_id': 3, 'name': 'SQLserver Certificate', 'site': 'mygreatlearning.com'

}

@app.route("/") def show(): return dicto

@app.route("/", methods=["PUT"]) def update(): dicto.append(dasamatebeli) return dicto

if name == "main": app.run(debug=True)

curl - X PUT http: // 127.0 .0 .1: 5000 /

9

import mechanicalsoup import pandas as pd import sqlite3

openai = mechanicalsoup.StatefulBrowser() openai.open("https://en.wikipedia.org/wiki/Comparison_of_Linux_distributions") th = openai.page.find_all("th", attrs={"class": "table-rh"}) distro = [value.text.replace("\n", "") for value in th] distro = distro[:95] td = openai.page.find_all("td") columns = [value.text.replace("\n", "") for value in td] columns = columns[6:1051] column_names = ["Founder", "Maintainer", "Initial_Release_Year", "Current_Stable_Version", "Security_Updates", "Release_Date", "System_Distribution_Commitment", "Forked_From", "Target_Audience", "Cost", "Status"] dictionary = {"Distribution": distro} for idx, key in enumerate(column_names): dictionary[key] = columns[idx:][::11] df = pd.DataFrame(data=dictionary) connection = sqlite3.connect("linux_distro.db") cursor = connection.cursor() cursor.execute("create table linux (Distro, " + ",".join(column_names) + ")") for i in range(len(df)): cursor.execute("insert into linux values (?,?,?,?,?,?,?,?,?,?,?,?)", df.iloc[i]) # iloc=integer location connection.commit() connection.close()

import requests

from bs4 import BeautifulSoup

import pandas as pd

url = "https://docs.python.org/3/library/random.html"

response = requests.get(url)

soup = BeautifulSoup(response.content, "html.parser")

functions = []

descriptions = []

dl_tags = soup.find_all("dl", class_="function")

for dl in dl_tags:

function_name = dl.dt.get_text(strip=True)

description = dl.dd.get_text(strip=True)

functions.append(function_name)

descriptions.append(description)

data = {"Function": functions, "Description": descriptions}

df = pd.DataFrame(data)

print(df)

from flask import Flask

app = Flask("name") wignebi = [{ "Saxeli": "Saqartvelos wigni", "fasi": "5lari", "isbn": 100

}, { "Saxeli": "Tbilisis wigni", "fasi": "5lari", "isbn": 101 }, {"Saxeli": "Samoqalaqo wigni", "fasi": "10lari", "isbn": 102 }] da = []

@app.route("/") def main(): return wignebi

@app.route("/int:isbn_code") def show(isbn_code): for i in wignebi: if i["isbn"] == isbn_code: da = {"Saxeli": i["Saxeli"], "fasi": i["fasi"]} return da

if name == "main": app.run(debug=True)

version 0.0.0.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codeforfinalbtu2024v6-0.0.1.tar.gz (7.3 kB view details)

Uploaded Source

File details

Details for the file codeforfinalbtu2024v6-0.0.1.tar.gz.

File metadata

  • Download URL: codeforfinalbtu2024v6-0.0.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for codeforfinalbtu2024v6-0.0.1.tar.gz
Algorithm Hash digest
SHA256 dc98cbc15049b155e4636c3934ef3825fb09d3cb60d08b42743e8adf7f86a348
MD5 0d4cf68b6c376a43439e19e49eba1ad4
BLAKE2b-256 b678c3cb52f9395097e051529ffb0d8d1e6ec930f39c18784ab25d79c28c199a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page