index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
12,689 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/oop/solutions/bank_account.py | class BankAccount:
# Magic methods
def __init__(self, account_number, account_name, balance=0):
self.account_number = account_number
self.account_name = account_name
self.balance = balance
def display(self):
print(self.account_number, self.account_name, self.balance, "₫")
... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,690 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/vingroup/vinhome.py | def ocean_park():
print('[vinhome] ocean_park()')
class VinHome:
pass
class Database:
pass | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,691 | yenlt6/learningpython | refs/heads/main | /Day16Exam2_TEMP/card_game/game.py | class Game:
'''
Class chứa các chức năng chính của game
Game chứa danh sách người chơi, và bộ bài
'''
def __init__(self):
pass
def setup(self):
'''Khởi tạo trò chơi, nhập số lượng và lưu thông tin người chơi'''
pass
def guide(self):
'''Hiển thị menu chức n... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,692 | yenlt6/learningpython | refs/heads/main | /Date16Exam2Date1610/main.py | import deck as dec
import player as pla
import card as ca
import subprocess as sp
import game as ga
def main(): # khó
game = ga.Game()
game.setup()
memu=[]
memu.append('1.Xem danh sách người chơi')
memu.append ('2.Thêm mới người chơi ')
memu.append ('4.Chia bài ')
memu.append('5.Lật bài:... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,693 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/card_game/card.py | class Card:
def __init__(self, rank, suit):
self._rank = rank
self._suit = suit
@property
def rank(self):
return 1 if self._rank == 'A' else self._rank
@property
def suit(self):
points = {'S': 0, 'C': 1, 'D': 2, 'H': 3}
return points.get(self._suit)
def... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,694 | yenlt6/learningpython | refs/heads/main | /Day18UnitTest2310/testing/tests/test_mock_server.py | # Third-party imports...
from unittest.mock import patch
# Local imports...
from services import get_users
from tests.mocks import get_free_port, start_mock_server
class TestMockServer(object):
@classmethod
def setup_class(cls):
cls.mock_server_port = get_free_port()
start_mock_server(cls.mock... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,695 | yenlt6/learningpython | refs/heads/main | /Day8Test1809/hackathon1_midterm/medium.py | def anagram_number(number):
a=str(number)[::-1]
if a==str(number):
return True
else :
return False
def roman_to_int(s):
rom_dict = {'IV':4,'IX':9,'XL':40,'XC':90,'CD':400,'CM':900,'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}
i = 0
int1 = 0
while i < len(s): ... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,696 | yenlt6/learningpython | refs/heads/main | /Day8Test1809/hackathon1_midterm/easy.py | # 1
from datetime import datetime
import re
def day_diff(release_date, code_complete_day):
release_date = datetime.strptime(release_date, "%d/%m/%Y")
code_complete_day = datetime.strptime(code_complete_day, "%Y-%d-%m")
return abs((release_date - code_complete_day).days)
# 2
def alpha_num(sentence):
re... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,697 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/hello.py | print("Hello class")
print("The variable __name__ tells me which context this file is running in.")
print("The value of __name__ is:", repr(__name__))
class Query():
pass
class Database():
pass
def main():
print("Hello in main!")
if __name__ == "__main__":
main() | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,698 | yenlt6/learningpython | refs/heads/main | /Day20FileHandling0611/file_handling/file_handling/writetodocfile.py | print("Ban muon ghi de hay them noi dung vao file?")
mode= input("> ") + "+"
contents = []
print("Nhap noi dung cho file")
while True:
line = input("> ")
if len(line) ==0:
break
contents.append(line + '\n')
with open('demo.txt', mode, encoding='utf8') as file:
file.writelines(contents)
with op... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,699 | yenlt6/learningpython | refs/heads/main | /python4testers_student/exercises/sample_debug.py | # To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# Viết chương trình Python kiểm tra số lớn nhất trong 3 số
#
# - Khai báo 3 biến `a`, `b`, `c` nhập giá trị số bất kỳ (int)
# - Kiểm tra và in ra số lớn nhất trong 3 số đó
# %%
a, b, c = 12, 16, 19
print(max(a,b,c))
... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,700 | yenlt6/learningpython | refs/heads/main | /day_8_temp/docfiledic.py |
#Bài 3: Bài tập tổng hợp phần Basic - Đếm từ
import sys
# Đếm từ
def print_words(filename):
words_count = readfile_count_words(filename)
words_count_sorted = sorted(list(words_count), key = lambda k: k[0])
for i in words_count_sorted:
print (i, ":", words_count[i])
def print_top(filename):
w... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,701 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/vingroup/products/vinfast.py | def lux_sa():
print('[vinfast] lux_sa()')
class VinFast:
pass
from vingroup.payments.vinid import id
id() | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,702 | yenlt6/learningpython | refs/heads/main | /Day102509/bank_account_from_file.py | import os
import sys
import csv
import json
import pprint
current_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
csv_file = os.path.join(current_dir, "bank_accounts.csv")
json_file = os.path.join(current_dir, "bank_accounts.json")
class BankAccount:
minimum_balance = 50000
def __init__(self, account_nu... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,703 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/card_game/deck.py | from card import Card
from random import shuffle
class Deck:
ranks = ['A', 2, 3, 4, 5, 6, 7, 8, 9]
suits = ['S', 'C', 'D', 'H']
def build(self):
self.cards = [Card(rank, suit)
for rank in Deck.ranks for suit in Deck.suits]
def shuffle_cards(self):
shuffle(self.c... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,707 | jUnion44/plastic | refs/heads/master | /core/migrations/0012_auto_20200723_1728.py | # Generated by Django 2.2.4 on 2020-07-23 17:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0011_mcpsschool'),
]
operations = [
migrations.AddField(
model_name='mcpsschool',
name='lat',
fi... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,708 | jUnion44/plastic | refs/heads/master | /core/migrations/0007_blogpost_compares.py | # Generated by Django 2.2.4 on 2020-07-13 15:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_auto_20200712_2017'),
]
operations = [
migrations.AddField(
model_name='blogpost',
name='compares',
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,709 | jUnion44/plastic | refs/heads/master | /core/migrations/0024_zipcode_population.py | # Generated by Django 2.2.4 on 2020-08-25 16:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0023_zipcode_area'),
]
operations = [
migrations.AddField(
model_name='zipcode',
name='population',
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,710 | jUnion44/plastic | refs/heads/master | /extractionhigh.py | from bs4 import BeautifulSoup
import camelot
import requests
import csv
from core.models import mcpsSchool
ROOT_URL = "https://www.montgomeryschoolsmd.org/"
datadump = [["High School","ppp_2014_2015","ppp_2015_2016","ppp_2016_2017","ppp_2017_2018","ppp_2018_2019"]]
html = open("high school links.html","r").read()
s... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,711 | jUnion44/plastic | refs/heads/master | /core/migrations/0004_auto_20200708_1746.py | # Generated by Django 2.2.4 on 2020-07-08 17:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0003_attachment'),
]
operations = [
migrations.AddField(
model_name='attachment',
name='link',
f... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,712 | jUnion44/plastic | refs/heads/master | /core/migrations/0008_auto_20200716_1415.py | # Generated by Django 2.2.4 on 2020-07-16 14:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_blogpost_compares'),
]
operations = [
migrations.AddField(
model_name='companycompare',
name='lat',
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,713 | jUnion44/plastic | refs/heads/master | /core/migrations/0011_mcpsschool.py | # Generated by Django 2.2.4 on 2020-07-23 17:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0010_blogpost_script'),
]
operations = [
migrations.CreateModel(
name='mcpsSchool',
fields=[
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,714 | jUnion44/plastic | refs/heads/master | /processAsset/copyFiles.py |
import boto3, sys
fileName = sys.argv[1]
fileAccName = sys.argv[2]
session = boto3.session.Session()
client = session.client('s3',
region_name='sfo2',
endpoint_url='https://sfo2.digitaloceanspaces.com',
aws_access_key_id="POTR4I5FSNCEF3OUGSV5",
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,715 | jUnion44/plastic | refs/heads/master | /core/migrations/0021_zipcode_average_income.py | # Generated by Django 2.2.4 on 2020-08-10 15:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0020_auto_20200810_1551'),
]
operations = [
migrations.AddField(
model_name='zipcode',
name='average_income'... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,716 | jUnion44/plastic | refs/heads/master | /core/migrations/0009_blogpost_desc.py | # Generated by Django 2.2.4 on 2020-07-18 17:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0008_auto_20200716_1415'),
]
operations = [
migrations.AddField(
model_name='blogpost',
name='desc',
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,717 | jUnion44/plastic | refs/heads/master | /core/migrations/0018_auto_20200810_0214.py | # Generated by Django 2.2.4 on 2020-08-10 02:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0017_zipcode'),
]
operations = [
migrations.AlterField(
model_name='zipcode',
name='code',
field... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,718 | jUnion44/plastic | refs/heads/master | /core/models.py | from django.db import models
from django.contrib.auth import get_user_model
from django.conf import settings
def get_sentinel_user():
return get_user_model().objects.get_or_create(username='Deleted User')[0]
# Create your models here.
class companyCompare(models.Model):
name = models.CharField(max_length=200... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,719 | jUnion44/plastic | refs/heads/master | /core/migrations/0022_auto_20200810_1726.py | # Generated by Django 2.2.4 on 2020-08-10 17:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0021_zipcode_average_income'),
]
operations = [
migrations.AddField(
model_name='mcpsschool',
name='ppp_2014... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,720 | jUnion44/plastic | refs/heads/master | /core/migrations/0014_auto_20200729_2304.py | # Generated by Django 2.2.4 on 2020-07-29 23:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0013_auto_20200724_1722'),
]
operations = [
migrations.AddField(
model_name='mcpsschool',
name='ppp_2015_201... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,721 | jUnion44/plastic | refs/heads/master | /core/views.py | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse,JsonResponse
from .models import *
from django.db.models import Model
from django.db.models import Field
from django.forms.models import model_to_dict
from django.core import serializers
import json
def getName(fieldString):
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,722 | jUnion44/plastic | refs/heads/master | /core/migrations/0002_companycompare.py | # Generated by Django 2.1.3 on 2020-07-03 11:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='companyCompare',
fields=[
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,723 | jUnion44/plastic | refs/heads/master | /core/migrations/0013_auto_20200724_1722.py | # Generated by Django 2.2.4 on 2020-07-24 17:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0012_auto_20200723_1728'),
]
operations = [
migrations.AddField(
model_name='mcpsschool',
name='desc',
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,724 | jUnion44/plastic | refs/heads/master | /middle.py | print(models)
import csv
datareader = csv.reader(open("outputmiddle.csv"))
first=False
for row in datareader:
if not first:
first = True
continue
s = models.mcpsSchool()
s.name = row[0]
s.schooltype="middle"
s.ppp_2014_2015 = row[1]
s.ppp_2015_2016 = row[2]
s.ppp_2016_2017 = ... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,725 | jUnion44/plastic | refs/heads/master | /core/urls.py | from django.urls import path
from . import views
app_name = "core"
urlpatterns = [
#Front Page
path('', views.index, name='index'),
path('explore/', views.explore, name='explore'),
path('explore/<int:eid>/', views.explorespecific, name='explorespecific'),
path('blog/', views.blog, name='blog'),
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,726 | jUnion44/plastic | refs/heads/master | /locatem.py | import csv
import requests, json
from core.models import mcpsSchool
from django.shortcuts import get_object_or_404
datareader = csv.reader(open("middleaddr.csv"))
BAD = [41,46]
for row in datareader:
if int(row[0]) in BAD:
continue
obj = get_object_or_404(mcpsSchool,pk=row[0])
pdfdata = json.load... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,727 | jUnion44/plastic | refs/heads/master | /core/migrations/0001_initial.py | # Generated by Django 2.1.3 on 2020-07-03 11:13
import core.models
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
op... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,728 | jUnion44/plastic | refs/heads/master | /core/migrations/0020_auto_20200810_1551.py | # Generated by Django 2.2.4 on 2020-08-10 15:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0019_auto_20200810_1551'),
]
operations = [
migrations.RenameModel(
old_name='zipcodeArchive',
new_name='zipcode',
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,729 | jUnion44/plastic | refs/heads/master | /core/admin.py | from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(blogpost)
admin.site.register(companyCompare)
admin.site.register(attachment)
admin.site.register(mcpsSchool)
admin.site.register(zipcode)
#admin.site.register(zipcodeArchive)
| {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,730 | jUnion44/plastic | refs/heads/master | /core/migrations/0010_blogpost_script.py | # Generated by Django 2.2.4 on 2020-07-18 18:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0009_blogpost_desc'),
]
operations = [
migrations.AddField(
model_name='blogpost',
name='script',
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,731 | jUnion44/plastic | refs/heads/master | /core/migrations/0006_auto_20200712_2017.py | # Generated by Django 2.2.4 on 2020-07-12 20:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0005_companycompare_tags'),
]
operations = [
migrations.AddField(
model_name='companycompare',
name='desc',
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,732 | jUnion44/plastic | refs/heads/master | /core/migrations/0025_zipcode_density.py | # Generated by Django 2.2.4 on 2020-08-25 16:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0024_zipcode_population'),
]
operations = [
migrations.AddField(
model_name='zipcode',
name='density',
... | {"/extractionhigh.py": ["/core/models.py"], "/core/views.py": ["/core/models.py"], "/locatem.py": ["/core/models.py"], "/core/migrations/0001_initial.py": ["/core/models.py"], "/core/admin.py": ["/core/models.py"]} |
12,769 | Merigold89/Testing-trial | refs/heads/main | /calculator.py | class Calculator:
def __init__(self, first, second):
self.first = first
self.second = second
def add(self):
""" Addition """
return self.first + self.second # przy zamianie na "+" na "-" pojawią się błędy w test_calculator.py
def multiply(self):
""" M... | {"/calculator_test.py": ["/calculator.py"], "/calculator_GUI.py": ["/calculator.py"]} |
12,770 | Merigold89/Testing-trial | refs/heads/main | /calculator_test.py | import unittest
import calculator
# aby uruchomić: linia komend: python -m unittest test_calculator
class TestCalculator(unittest.TestCase):
def setUp(self):
"""
Is executed before every test method.
"""
self.calc = calculator.Calculator(5, 1)
print('setUp meth... | {"/calculator_test.py": ["/calculator.py"], "/calculator_GUI.py": ["/calculator.py"]} |
12,771 | Merigold89/Testing-trial | refs/heads/main | /test_calculator_simple.py | import unittest
import calculator_simple
# aby uruchomić: linia komend: python -m unittest test_calculator lub dodać ostatni fragment kodu
# plik test_calclator.py i calculator.py muszą być w jednym folderze
class TestCalculator(unittest.TestCase): # a test case for the calculator.py module
def test_add(self):
... | {"/calculator_test.py": ["/calculator.py"], "/calculator_GUI.py": ["/calculator.py"]} |
12,772 | Merigold89/Testing-trial | refs/heads/main | /calculator_GUI.py | # from __future__ import unicode_literal # obsługa polskich liter
import calculator
from PyQt5.QtWidgets import QApplication, QWidget # importujemy klasy z modulu
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QLabel, QGridLayout
from PyQt5.QtWidgets import QLineEdit, QPushButton, QHBoxLayout # linia... | {"/calculator_test.py": ["/calculator.py"], "/calculator_GUI.py": ["/calculator.py"]} |
12,773 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/inheritance.py | class bankAccount:
def __init__(self, acct_id, acct_type, cust_id, cust_name, balance, credit_line):
self.acct_id = acct_id
self.acct_type = acct_type
self.cust_id = cust_id
self.cust_name = cust_name
self.balance = balance
self.credit_line = credit_line
def dep... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,774 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/oddEven.py | def is_even(number):
if number % 2 == 0:
return True
return False
for i in range(10):
print('Is the number:', i, " a even?", is_even(i))
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,775 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/ExceptionHandling/raiseAndThrowExceptions.py | i = input("Enter a number :")
j = input("Enter another number :")
try:
if i == '0' or j == '0':
raise ValueError("Input cannot be zero")
print(i+j)
except ValueError as ve:
print(ve)
except Exception as e:
print(e)
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,776 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/FileWriteReadDicts.py | performances = {'Ventriloquism': '9:00am',
'Snake Charmer': '12:00pm',
'Amazing Acrobatics': '2:00pm',
'Enchanted Elephants': '5:00pm'}
print(performances)
print("------------Writing above values into file-----------")
schedule_file = open('schedule.txt', 'w'... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,777 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/dictionaries.py | #!/usr/bin/env python
# coding: utf-8
#A dictionary is a collection which is unordered, changeable and indexed.
#In Python dictionaries are written with curly brackets, and they have keys and values.
# Key Value Pairs
mydict = {'a': 'apple',
'b': 'ball',
'c': 'cat',
'd': 'dog'}
print(myd... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,778 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Operators/bitwise.py | # Bitwise Operator & | ^
print('Bitwise AND operator')
print(0 & 0)
print(0 & 1)
print(1 & 0)
print(1 & 1)
print('Bitwise OR operator')
print(0 | 0)
print(0 | 1)
print(1 | 0)
print(1 | 1)
print('Bitwise ExOR operator')
print(0 ^ 0)
print(0 ^ 1)
print(1 ^ 0)
print(1 ^ 1)
print('<< Binary Left Shift')
a = 240
print(a... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,779 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/swapTwoNumbers.py | print("---------Continue---------")
# without temp variable
i=10
j=11
print(i,j)
i=i+j
j=i-j
i =i-j
print(i,j)
print("---------Continue---------")
# with temp variable
i=10
j=11
print(i,j)
temp = j
j = i
i = temp
print(i,j)
print("---------Continue---------")
# With Python, optimized code
i=10
j=11
print(i,j)
i,j = j... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,780 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/class_print_student_details.py | import math
class Student:
# Encapsulation: Binding data and methods together
# Also talks about, data access specifiers
def __init__(self, name, age, maths, phy, che):
self.name = name
self.age = age
self.maths = maths
self.phy = phy
self.che = che
# End of... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,781 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/remove_duplicates_lists.py | # [2,2,3,5,5]. Remove duplicate elements and print
my_list = [2, 2, 3, 3, 4, 5, 6, 7, 7]
new_list: list = []
for i in my_list:
if i not in new_list:
new_list.append(i)
print(new_list)
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,782 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/iterators.py | my_greetings = "helloworld"
iter_str = iter(my_greetings)
print(next(iter_str), end="")
print(next(iter_str), end="")
print(next(iter_str), end="")
print(next(iter_str), end="")
print(next(iter_str), end="")
print(next(iter_str), end="")
print(next(iter_str), end="")
print(next(iter_str), end="")
print(next(iter_str), ... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,783 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/classesAndObjects.py | # Class is a collection of objects
# Class is a blueprint for creating an object
# Class is a logical Entity
# An Object is an instance of class
class Calculator:
def add(self, i, j):
# self - (this) pointer pointing to current instance which is invoking
# Any method called via object instance sh... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,784 | sanneabhilash/python_learning | refs/heads/master | /File_Actions_Automation/copymove.py | # import os
# import shutil
# import zipfile
# import time
#
# from readwrite import readcfg
#
#
# def mergepaths(path1, path2):
# pieces = []
# parts1, tail1 = os.path.splitdrive(path1)
# parts2, tail2 = os.path.splitdrive(path2)
# result = path2
# parts1 = tail1.split('\\') if '\\' in tail1 else t... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,785 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Operators/comparision.py | # Operators:
# Arithmetic
# Comparision
# Logical
# Membership
# Identity
# Bitwise
# Comparision operators
print('----------Comparision-------')
i = 10
j = 20
print(i > j)
print(i < j)
print(i >= j)
print(i <= j)
print(i == j)
print(i != j) # Not equal
# print(i<>j) # Not equal, not supported in python v3.X
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,786 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/fileHandling_Exceptions.py | # Python file object provides basic methods to manipulate files such as open, read, write, append & close methods
# file object = open(file name[, access mode][, buffersize])
# files can be opened in read mode, write mode or append mode
# file read methods
# read() #return one big string
# readline #return one line a... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,787 | sanneabhilash/python_learning | refs/heads/master | /unit_testing_examples/test_pytestPractice.py | from Concepts_with_examples.modules_and_packages.carsPackage import Audi
import pytest
@pytest.mark.set1
def test_file1_method1():
x = 5
y = 6
assert x + 1 == y, "test failed"
print("Executed Test_file1")
@pytest.mark.set2
def test_new_car():
car = Audi.AudiSubDealers()
print(car.dealers())
... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,788 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/ExceptionHandling/handlingValueError.py | performances = {'Ventriloquism': '9:00am',
'Snake Charmer': '12:00pm',
'Amazing Acrobatics': '2:00pm',
'Enchanted Elephants': '5:00pm'}
schedule_file = open('schedule.txt', 'w')
for key, val in performances.items():
schedule_file.write(key, "-", val)
sch... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,789 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/fibonacci.py | def print_fibonacci(n):
if n == 1:
print(0, end = " ")
elif n == 2:
print(0,1, end = "")
else:
print(0,1, end=" ")
a = 0
b = 1
while n > 2:
print(a+b, end = " ")
a, b = b, a+ b
n = n -1
return 0
for i in range(1, 2... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,790 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/set_operations.py | # These are unordered sets
my_empty_dictionary = {} # Creates an empty dictionary
my_empty_set = set() # Creates an empty set
print(my_empty_set)
print(type(my_empty_set))
my_set = {100, 200, 20, 12, 4, 'hello'}
print(type(my_set))
print(my_set)
my_set.add(200)
my_set.add(200) # duplicate values are not added
pri... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,791 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/export_excel_data_to_mysql/excel_to_mysql.py | import xlrd
import MySQLdb
# Open the workbook and define the worksheet
book = xlrd.open_workbook("data.xls")
sheet = book.sheet_by_name("source")
# Establish a MySQL connection
connection = MySQLdb.connect(host="localhost", user="root", passwd="root", db="mysqlPython")
# Get the cursor, which is used to traverse th... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,792 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/AccessModifiers/public.py | #PUBLIC : All member variables and methods are public by default in Python.
class Jar:
def __init__(self):
self.content = None
def fill(self, content):
self.content = content
def empty(self):
print('empty the jar...')
self.content = None
myJar = Jar()
myJar.content = "... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,793 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Oops_static_instance_variables.py | # Class or static variables are shared by all objects. Instance or non-static variables are different for different objects (every object has a copy of it).
# In C++ and Java, static keyword helps to make a variable as class variable. The variables which don’t have preceding static keyword are instance variables.
# The... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,794 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/regular_expressions.py | # regex is to search for a given pattern in a string
# syntax: match = re.search(pat, str)
# In Python regular expression supports various things like Modifiers, Identifiers, and White space characters
# RegEx Functions
# Function Description
# findall Returns a list containing all m... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,795 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/calculate_student_grade_dictionary.py | # Calculate grade using nested dictionaries
student_record = {1000: {'name': 'A', 'M': 50, 'P': 60, 'C': 70}, 1001: {'name': 'B', 'M': 55, 'P': 65, 'C': 75}}
for key, value in student_record.items():
print('****************************')
print('ID: ' + str(key))
total_marks = 0
for k1, v1 in value.ite... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,796 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/sumOfNaturalNumbers.py | def sum_of_natural_numbers(number):
total: int = 0
while number > 0:
total = total + number
number -= 1
return total
def recursive_sum(number):
total: int = 0
for i in range(number):
total = total + i;
return total
print('While Loop Sum: ', sum_of_natural_numbers(10))... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,797 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Sqlite3_interactions.py | ############################################################
# SQLITE3 DATABASE CONNECTION AND EXCEPTION HANDLING
import sqlite3 as lite
import sys
# create sqlite connection and retrieve the sqlite version
con = None
try:
con = lite.connect('common.db')
cur = con.cursor()
cur.execute('SELECT SQLITE_VERS... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,798 | sanneabhilash/python_learning | refs/heads/master | /File_Actions_Automation/zip.py | import zipfile
zipf = zipfile.ZipFile('./target.zip', 'w', allowZip64=True)
zipf.write('./ftp.py')
zipf.write('./walkdir.py')
zipf.close()
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,799 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/lists.py | my_greetings='Hello world'
print(my_greetings)
print(my_greetings[0])
print(my_greetings[1])
# Slicing an array
print(my_greetings[0:3]) # Start included, end excluded
print(my_greetings[4:9])
# Negative indexing
print(my_greetings[-1])
print(my_greetings[-2])
# Immutable Strings, Assignment throws error
# TypeErro... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,800 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Operators/membership.py | # Python’s membership operators test for membership in a sequence, such as strings, lists, or tuples
from typing import List
myList: List[str] = ['apple', 'orange', 'banana']
fruit = 'apple'
# in operator
# Evaluates to true if it finds a variable in the specified sequence and false otherwise.
if fruit in myList:
... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,801 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/set_intro.py | #A set is an unordered collection of items. Every element in the set is unique (no duplicates).
#Sets can be used to perform mathematical set operations like union, intersection, symmetric difference etc.
#Accessing Set : You cannot access items in a set by referring to an index, since sets are unordered and the items ... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,802 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/simpleInheritance.py | class human:
def __init__(self, name, gender='female'):
self.name = name
self.gender = gender
def greet(self, message):
self.message = message
print(self.message, self.name)
class man(human):
def __init__(self, name, age, message):
super().__init__(name, 'male')
... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,803 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/AccessModifiers/private.py | # By default all member variables and methods are pubic
# if you want make a method or variable private, use __ before the name
#PRIVATE : By declaring your data member private you mean, that nobody should be able to access it from outside the class
#This feature turns every member name prefixed with at least two unde... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,804 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/ExceptionHandling/customExceptions.py | # CUSTOM Exception design
class ErrorInCode(Exception):
def __init__(self, data):
self.data = data
def __str__(self):
return repr(self.data)
try:
a = int(input('Enter a number:'))
if a <= 0:
raise ErrorInCode(2000)
except ErrorInCode as ae:
print("Received Error:", ae.da... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,805 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/modules_and_packages/carsPackage/Audi.py | class AudiCar:
def __init__(self):
self.models = ['q7', 'a8', 'a3', '343']
def out_models(self):
print("Existing models are: ")
for model in self.models:
print(model)
return ""
class AudiSubDealers:
def __init__(self):
self.dealers = ['1', '2', '3', '4']... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,806 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/regExForPassword.py | import re
pattern = "^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$"
password = input("Enter string to test: ")
result = re.findall(pattern, password)
if result:
print("Valid password")
else:
print("Password not valid")
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,807 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/datatypes.py | # Everything is an object in python
i = 5
j = 6.5
greeting = "Hello World"
myflag = True
print(i, j, greeting, myflag)
print('-------------Continue-------------')
# Pring Data type of the variables
print(type(i))
print(type(j))
print(type(greeting))
print(type(myflag))
print('-------------Continue-------------')
# P... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,808 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Operators/assignment.py | i = 10
j = 20
k = j + 1 # k is assigned the value of j
# c += a is equivalent to c = c + a
m = 5
m += j
print('Add AND ', m)
# c -= a is equivalent to c = c - a
m = 5
m -= j
print('Subtract AND ', m)
# c *= a is equivalent to c = c * a
m = 5
m *= j
print('Multiply AND ', m)
# c /= a is equivalent to c = c / a. c... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,809 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Singleton_Class.py | # In object-oriented programming, a singleton class is a class that can have only one object (an instance of the #class) at a time. After first time, if we try to instantiate the Singleton class, the class should raise an #exception or the new variable should also point to the first instance created.
class Singleton:... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,810 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/iterators_loops.py |
# For loop
print('For Loop Execution')
for i in range(0, 10):
print(i)
print('For Loop Execution2')
for i in range(10):
print(i * 10)
# while iteration
print('while Loop Execution')
j = 10
i = 0
while j > i:
print(1 + i)
i += 1
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,811 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Oops_Intro.py | Class: A
class is a collection of objects which have common properties.A class is a template or blueprint from which objects are created.It is a logical entity.It can't be physical. A class in Python can contain: Fields, Methods & Constructors
Object: object is one
of
instances
of
the
class . which can perform ... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,812 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/modules_import_weather_data/circus.py | import PracticePrograms.modules_import_weather_data.weather as weather
def main():
weather.current_weather()
main()
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,813 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/Operators/arithmetic.py | i=9; # Declaring and initializing integer variable i, j
j=8
print(i+j) # Print addition of two numbers
print(i-j) #substraction
print(i*j) #multiplication
print(i/j) #divivision
print(i%j) #Modulus
print(i//j) #floor div
print(i**j) # power or Exponent
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,814 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/polymorphism_method_overriding.py | class Animal:
def whoAmI(self):
print("I am Animal")
def eat(self):
print("Animal is eating")
@staticmethod
def walk():
print('Animal is walking')
class Dog(Animal):
def __init__(self):
print("Dog created")
# Method overriding
def whoAmI(self):
pr... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,815 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/swapNumbersLambda.py | from copy import copy
swapper = lambda l, m: (m, l)
x = 10
y = 11
print(x, y)
x, y = swapper(x, y)
print(x, y)
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,816 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/strings.py | # A string is a list of characters in order
# In Python String is immutable
# creating a string
s1 = "hi,"
s2 = "how are you doing?"
print(s1)
print(s2)
# accessing a string using index
print(s1[0])
print(s2[0])
# slice a string
print(s1[0:3])
print(s2[0:3])
# string is immutable, str object does not support item ... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,817 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/importing_modules.py | # import math module
import math
print("Floor of 3.4 :", math.floor(3.4))
print("e value:", math.e)
print("inf:", math.inf)
print("value of pi:", math.pi)
print("Not a number:", math.nan)
print("tau value:", math.tau)
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,818 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/modules_and_packages/math_module.py | #############################################################
# PYTHON MATH MODULE
import math
# square root(sqrt) function in math module
print(math.sqrt(36))
# pi function contained in math module
print(math.pi)
# Sine of 2 radians
print(math.sin(2))
# Cosine of 0.5 radians
print(math.cos(0.5))
# Tangent of 0.23... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,819 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/modules_and_packages/importSinglePackage.py | # import Audi module from cars package aliased as car
import Concepts_with_examples.modules_and_packages.carsPackage.Audi as Car
car1 = Car.AudiCar()
print(car1.out_models())
dealer1 = Car.AudiSubDealers()
print(dealer1.out_dealers())
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,820 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/bank_account_without_inheritance.py | # Without inheritance
class BankAccount:
def __init__(self, custId, custName, custPhone, custEmail, accType, accBal, accNumber):
self.id = custId
self.name = custName
self.phone = custPhone
self.email = custEmail
self.accType = accType
self.bal = accBal
self... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,821 | sanneabhilash/python_learning | refs/heads/master | /PracticePrograms/string_reverse.py | # Without recursion
def reverse(greetings):
rev = ''
for i in greetings:
rev = i + rev
return rev
# end of function reverse
# Reverse String using Recursion
def rev_string(mystring):
if len(mystring) == 0:
return mystring
else:
return rev_string(mystring[1::]) + mystrin... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,822 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/tuples.py | # Tuple is an ordered sequence of items same as list.The only difference is that tuples are immutable.
# Tuples once created cannot be modified. Tuples are immutable.
my_tuple = ("apples", "bananas", "oranges", "kiwis")
# accessing tuple using index
print(my_tuple[0])
print(my_tuple[3])
# slicing tuple
print(my_tupl... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,823 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/ExceptionHandling/exceptionHandling.py | """
Python has 60+ types of exceptions.
FileNotFoundError - File specified does not exist
IndexError - Index out of bound
KeyError - Key doesn't exist
NameError - Variable name doesn't exist in local or global scope
ValueError - Value is wrong type
"""
# Try and except allows to exscape from... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,824 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/ExceptionHandling/Intro.py | ##############################################################
# RAISE EXCEPTION
try:
a = int(input("Enter a?"))
b = int(input("Enter b?"))
if b is 0:
raise ArithmeticError;
else:
print("a/b = ", a / b)
except ArithmeticError:
print("The value of b can't be 0")
####################... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,825 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/lambdas/Intro.py | #A lambda in Python is a single expression anonymous function often used as inline function.
#A lambda form #in python does not have statements as it is used to make new function object and then return them at run time.
i=8
j=4
#function to add two variables
def add(x,y):
return x+y
result=add(i,j)
print(result)
... | {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,826 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/lambdas/reduce.py | # reduce() function takes in a function and a list as argument
# new reduced result is returned
from functools import reduce
mylist = [1, 3, 5, 6, 7]
mul = reduce((lambda x, y: x * y), mylist) # returns product of all elements in mylist
print(mul)
print(type(mul))
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
12,827 | sanneabhilash/python_learning | refs/heads/master | /Concepts_with_examples/lambdas/filter.py | # Filter out all elements of a sequence
mylist = [1, 3, 4]
mylist = list(filter(lambda x: (x > 2), mylist))
print(mylist)
| {"/PracticePrograms/modules_import_weather_data/circus.py": ["/PracticePrograms/modules_import_weather_data/weather.py"], "/Concepts_with_examples/modules_and_packages/importSinglePackage.py": ["/Concepts_with_examples/modules_and_packages/carsPackage/Audi.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.