blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
7e278951489cd0889b61d0d046df30080af235f0 | thefakemacaw/top-down-shooter | /topDownShooter/classes.py | UTF-8 | 677 | 2.96875 | 3 | [
"CC0-1.0"
] | permissive | import configparser
import os
import sys
import math
import pygame
#The class represents the enemy Block Zombies
class blockZombie(pygame.sprite.Sprite):
def __init__(self, color, width, height):
super().__init__()
self.image = pygame.Surface([width, height])
self.image.fill(RED)... | true |
431c8c70674de9d36365649fd334fa349b6bd58f | leeminHong1990/UniversalFrameWork | /kbengine/assets/scripts/common/classutils.py | UTF-8 | 967 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import inspect
from types import MethodType
from functools import wraps
def checkEntityID(func):
""" check client to cell RPC """
@wraps(func)
def wrapper(self, callerEntityID, *args):
if self.id != callerEntityID:
return
return func(self, callerEntityID, *args)
return wrapper
de... | true |
8ba99329989c75a9c47870a44392555295f3b4b0 | quarkfin/qf-lib | /qf_lib/backtesting/portfolio/utils.py | UTF-8 | 2,652 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | true |
668373bcca2d9b937d44118f038cca6f01c5ccd3 | abhinand5ai/Fluency | /LC/monthly/2020/July/AllPaths.py | UTF-8 | 527 | 2.96875 | 3 | [] | no_license | from collections import defaultdict
from typing import List
class Grid:
def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]:
paths = []
n = len(graph)
def dfs(node:int, path:List[int]):
if node == len(graph) - 1:
paths.append(path[:... | true |
752f197f9c653813766667e7911ad58d7f132bd0 | rohan1561/Hackerrank-Solutions | /artificial_intelligence/bot_saves_princess.py | UTF-8 | 533 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python
def displayPathtoPrincess(n,grid):
n = int((n-1)/2)
if 'p' in grid[0]:
if grid[0][0] == 'p':
answer = n*'UP\nLEFT\n'
else:
answer = n*'UP\nRIGHT\n'
if 'p' in grid[-1]:
if grid[-1][0] == 'p':
answer = n*'DOWN\nLEFT\n'
else... | true |
b9c90e856b981abbcaec9ef65e39ad14a964aa57 | 384401056/PythonProject | /XDLPython/03 面向对象/23_异常处理01.py | UTF-8 | 873 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding utf-8 -*-
def f1():
'''捕捉多种类型的异常'''
mylist = []
mylist.append('aaaaaa')
inp = input("输入数字:")
try:
n = int(inp)
l = mylist[n]
print(l)
except ValueError:
print('输入的不是数字')
except IndexError:
print('列... | true |
079834da00fdc32457285df98afad4dbb549f152 | binnev/project-euler | /python/puzzles/euler14.py | UTF-8 | 1,526 | 3.53125 | 4 | [] | no_license | # Longest Collatz sequence
"""
The following iterative sequence is defined for the set of positive integers:
n → n/2 (n is even)
n → 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following sequence:
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
It can be seen that this sequence (starting ... | true |
74cad121d6edf6ba2e8960e9fc6ce68be87ad514 | NhatNam-Kyoto/Python-learning | /python2.7/code/Accountmanager/file_khac/readl.py | UTF-8 | 95 | 2.875 | 3 | [] | no_license | input_file = "Test.txt"
f= open(input_file)
line = f.readline()
print line
print f.readline(2)
| true |
39abb8892161aa334188ba8b365e6f21fbe3b037 | vnaveen0/practice_python | /LinkedList/linkedlist2int.py | UTF-8 | 664 | 3.1875 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def getDecimalValue(self, head):
"""
:type head: ListNode
:rtype: int
"""
num = []
wh... | true |
9888dc8ce79c4f85555b39304340152f41cb4631 | rathoregaurav/OpenCV-with-Python | /Arith_operation_on_img/Arith.py | UTF-8 | 271 | 2.515625 | 3 | [] | no_license | #Yogesh Pawar
import numpy as np
import cv2
img1=cv2.imread("3D-Matplotlib.png",1)
img2=cv2.imread("mainsvmimage.png",1)
#add=img1+img2
add=cv2.add(img1,img2)
cv2.namedWindow("add",cv2.WINDOW_NORMAL)
cv2.imshow("add",add)
cv2.waitKey(0)
cv2.destroyAllWindows()
| true |
ea9374a695f7804de646251bed534c80ac762cc1 | FBroy/LIO2021 | /Qualification/Checksum/CHECKSUM.py | UTF-8 | 3,260 | 3.859375 | 4 | [] | no_license | #This method changes all letters into numbers
def lettersToNumbers(code):
letters = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
index = 0
while index < len(code):
if (code[index] in letters):
code = code[:index] + str(letters.index(code[index])//2 + 10) + code[index+1:]
... | true |
6354114c5bbb48613a8acfed71fac238d4d3fcfc | ywfan617/python- | /pintia/第3章-14 字符串字母大小写转换.py | UTF-8 | 324 | 3.390625 | 3 | [] | no_license | def chartrans(strs):
res=""
for i in strs:
if "a"<=i<="z":
res+=i.upper()
elif "A"<=i<="Z":
res+=i.lower()
elif i=="#":
continue
else:
res+=i
return res
if __name__=="__main__":
res=chartrans("Hello World! 123#")
print(... | true |
0ffda58f553384df8d652a3d42cf9911a32c42a0 | veronicazgirvaci/pyramid_fullauth | /tests/cases/test_unit/test_tools.py | UTF-8 | 807 | 2.59375 | 3 | [
"MIT"
] | permissive | import pytest
from pyramid_fullauth.tools import validate_passsword, password_generator
from pyramid_fullauth.exceptions import (
EmptyError, ShortPasswordError, PasswordConfirmMismatchError
)
class TestTools(object):
@pytest.mark.parametrize(('password', 'exception'),
[('', Empt... | true |
02013bf5d941886e8fbd1fbfe578f0492c11c6dc | Anemone95/kc_program_rec | /engine/sklearn_demo.py | UTF-8 | 954 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# -*-coding=utf-8-*-
import nltk, string
from sklearn.feature_extraction.text import TfidfVectorizer
stemmer = nltk.stem.porter.PorterStemmer()
remove_punctuation_map = dict((ord(char), None) for char in string.punctuation)
def stem_tokens(tokens):
return [stemmer.stem(item) for item in tok... | true |
38194b883b22f1ccc8901f2bb6e2435963942e05 | niksonnn/parsing | /multipars.py | UTF-8 | 1,281 | 2.859375 | 3 | [] | no_license | import requests
import csv
from bs4 import BeautifulSoup
from multiprocessing import Pool
from time import sleep
def get_html(url):
#sleep(1) - замедлять парсинг
response = requests.get(url)
html = response.text
return html
def write_csv(data):
with open("live_internet.csv", "a", encoding = "utf... | true |
040435d293a0f9dc2d1704ba1dd027eece27b7b8 | sifatron/Twitter-Event-Detection | /GloVe 6B.py | UTF-8 | 2,221 | 2.765625 | 3 | [] | no_license | # GlovE 6B Gensim VecSize300
import gensim
import glove
from gensim.scripts.glove2word2vec import glove2word2vec
from gensim.models import KeyedVectors
print('creating 300d glove')
glove_input_file = 'glove.6B.300d.txt'
word2vec_output_file = 'glove.6B.300d.txt.word2vec'
glove2word2vec(glove_input_file, word2vec_o... | true |
f98b7c488c4d610b9c53c09be9848774311be66d | DongHyunByun/algorithm_practice | /past_archive/swexpert/6057(triangleOfGraff).py | UTF-8 | 562 | 2.953125 | 3 | [
"MIT"
] | permissive |
for t in range(int(input())):
tri=0
N,M = map(int,input().split())
L=[[] for i in range(N-1)]
pair=[]
for m in range(M):
a,b= map(int,input().split())
L[a-1].append(b)
for n in range(N-2):
for i in range(len(L[n])):
for j in range(i+1,len(L[n])):
... | true |
82bcd01bf92bf774129b3a435b01346a01d80a96 | fangyang1996212/vipy | /vipy/dropbox.py | UTF-8 | 2,384 | 2.609375 | 3 | [
"MIT"
] | permissive | import os
from os import path
import urllib.parse as urlparse
from vipy.util import try_import
class Dropbox():
_access_token = os.environ.get('VIPY_DROPBOX_ACCESS_TOKEN')
_app_key = os.environ.get('VIPY_DROPBOX_APP_KEY')
_app_secret = os.environ.get('VIPY_DROPBOX_APP_SECRET_KEY')
def __init__(self)... | true |
fb70879da534d0337152fba4a58a59538f0f9e09 | Deep-Spark/DeepSparkHub | /cv/classification/resnet50/pytorch/common_utils/loss.py | UTF-8 | 1,443 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2022 Iluvatar CoreX. All rights reserved.
# Copyright Declaration: This software, including all of its code and documentation,
# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX
# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance... | true |
700351b8c365e161427b45809534bfdae12fa730 | M-Fathan-A-R/Tugas-18-Februari-2021-M-Fathan-A-R_XI-5_21 | /4.py | UTF-8 | 261 | 3.109375 | 3 | [] | no_license | vowels = "aiueo"
ip_str = "Halo nama saya Seviko Attalarik Pramayudha Handoko saya sedang belajar python"
ip_str = ip_str.casefold()
count = {}.fromkeys(vowels, 0)
for char in ip_str :
if char in count:
count[char] += 1
print(count) | true |
a74fcdf2c1e54425af7aed757e1cf446b1e358e5 | Bray821/PythonProgram1 | /new_classes.py | UTF-8 | 1,104 | 4.1875 | 4 | [] | no_license | class player:
def __init__(self,name,health,power):
self.name = name
self.health = health
self.power = power
self.players = 0
def get_stats(self):
return f"{self.name} {self.health} {self.power}, there is currently {self.players} in the game"
def update_players(self,n... | true |
e49c59fe119a32e02e5b3d3781ab1e8f7d755ff2 | ZhouRuiXiang/Flask_Note | /Ajax_Restful/flask_restufl/app.py | UTF-8 | 2,382 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-#
from flask import Flask,url_for
from flask_restful import Api, Resource, reqparse, inputs, marshal_with, fields
import config
from exts import db
from models import User, Article, Tag
from articleViews import article_bp
app = Flask(__name__)
app.config.from_object(config)
db.init_app(app)
ap... | true |
ca9369a2c780962a6e0104a1cd452ec567fc5a16 | CarolineNB/Matching-Algorithm | /AppendixB.py | UTF-8 | 1,022 | 3.4375 | 3 | [] | no_license | #The following is the coded randomizing algorithm that is set in printing out 100 student rankings
#and 100 project rankings.
import numpy as np
from numpy import random
n = 100
employeeNames3 = []
for i in np.arange(0,n):
employeeName = "Emp" + str(i)
employeeNames3.append(employeeName)
projectNames3 = np.arang... | true |
e36e49ddcb4eccdc881a4e9812b3e019617a8acb | un-knower/big-data-playground | /docker/data/delete_all_data.py | UTF-8 | 522 | 2.546875 | 3 | [] | no_license | import os
import shutil
this_script = os.path.realpath(__file__)
top_dir = os.path.dirname(this_script)
for root, dirs, files in os.walk(top_dir):
for f in files:
filename = os.path.join(root, f)
if not (filename == this_script or f.endswith('.gitignore')):
os.remove(filename)
def dir... | true |
43e1fec946b01b8c03745fca7f98bef75bcf8071 | ai-kmu/etc | /algorithm/2021/0224_Course Schedule III/jungmin.py | UTF-8 | 877 | 3.28125 | 3 | [] | no_license | class Solution(object):
def scheduleCourse(self, courses):
if courses == 0 or len(courses) == 0:
return 0
day_sort = sorted(courses, key = lambda x : x[1]) # d값 기준으로 course 리스트 정렬
during = 0
count = 0
for i in range(len(day_sort)):
during = during ... | true |
4bae8b546b7039b3f5b2e0d4632f4c9b11b0afbf | petervel/Euler | /problems_026-050/problem27.py | UTF-8 | 735 | 3.6875 | 4 | [] | no_license | #!/usr/bin/python
__author__ = 'peter.vel'
def filter_prime(prime, list):
n = 2 * prime
while n < len(list):
list[n] = False
n += prime
def sieve(list):
halfway = int(len(list)/2) + 1
for i in range(2, halfway):
if list[i]:
filter_prime(i, list)
return list
def check_primes(max):
list = [True] * max
... | true |
fb3d33a8b9b299aa7194b9e37377b1c3fc8cab49 | Henri2018/projetinno_agri | /lecturefichiers.py | UTF-8 | 2,653 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 15:59:28 2017
Lecture de fichiers
@author: elena
"""
import os
os.chdir("/Users/elena/Documents/2A/Projetinno/code") #ecrire le chemin où se trouve les fichiers qui vont être utilisés
def initialisationParametres(docname): #le nom du fichier doit inclure l'extension (... | true |
38ced0376a92d1cc47fc33e6f27965b6126f8f29 | xyuany/Python | /algo/ch4_Stack.py | UTF-8 | 1,198 | 4.375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 27 15:10:43 2020
@author: yyuan
"""
"""
栈(Stack)
Stack() 创建一个新的空栈
push(item) 添加一个新的元素item到栈顶
pop() 弹出栈顶元素
peek() 返回栈顶元素
is_empty() 判断栈是否为空
size() 返回栈的元素个数
顺序表list用尾部储存,链表从头部储存时间复杂度最低
"""
class Stack():
"""Stack"""
def __init__(self):
self.__list = []
... | true |
02181132d051536a41c21c31e9d2b6e689363ad7 | AnanyaAppan/BMTC-route-duration-prediction | /extract_21_17.py | UTF-8 | 1,540 | 2.546875 | 3 | [] | no_license | from pyspark.sql import SparkSession
from pyspark.sql import SQLContext
import sys
import pandas as pd
from pyspark.sql.functions import monotonically_increasing_id
filename = "/media/slr/TOSHIBA EXT/filtered_data/filtered_sorted_partaa.csv"
spark = SparkSession \
.builder \
.appName("Python Spark SQL basic e... | true |
3e7cd62374aedf39f3ed3512556dbb4ba5968977 | q737645224/python3 | /python基础/python笔记/day03/exercise/string_center.py | UTF-8 | 253 | 4.0625 | 4 | [] | no_license | # 练习:
# 1. 写一个程序,输入一个字符串,把字符串的第一个
# 字符和最后一个字符去掉后,打印出处理后的字符串
s = input("请输入字符串: ")
c = s[1:-1] # c = s[1:len(s)-1]
print("结果是:", c) | true |
78c80b4c5d51bbdbd366997261ec9a9ae7b95c12 | feitianyiren/djiboutimovies | /background.py | UTF-8 | 2,901 | 2.59375 | 3 | [] | no_license | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djiboutimovies.settings")
import django
django.setup()
import requests
import json
import os
import shutil
import sqlite3
import dbutils
import sys
from movies.models import Movie
INPUT_FILE_FOLDER = "/Users/augiedoebling/media/"
OUTPUT_FILE_FOLDER = "/Users/... | true |
fa54aeaf35f53b74cc984206093b1f2953d9fe3f | seo1511kr/TIL | /pycharm/python/day3 sequence, dict.py | UTF-8 | 14,823 | 4.21875 | 4 | [] | no_license | # # 문자열 삽입
# print(",".join("abcd"))
# # 리스트에 저장되어 있는 각각의 컴마(,)와 결합하여 하나의 문자열이 됨
# print(["a","b","c","d"])
# print(",".join(['a','b','c','d']))
# print("".join(['a','b','c','d']))
# a=[10,20,30]
# a.pop()
# a.pop()
# a.pop()
# print(a) # 빈 리스트 출력
# # # 자료구조(list[], tuple(), set{}, dictionary{})
# # ------------... | true |
070bc0ef7f298ee3c48188f68223e6a87c6ab9d4 | wenzelt/network_security_challenges_tum | /src/util/helpers.py | UTF-8 | 2,224 | 3.625 | 4 | [] | no_license | """
Collection of helper functions over the project
"""
import ast
import operator as op
import sys
# supported operators
operators = {
ast.Add: op.add,
ast.Sub: op.sub,
ast.Mult: op.mul,
ast.Div: op.truediv,
ast.Pow: op.pow,
ast.BitXor: op.xor,
ast.USub: op.neg,
}
def double_digits_from... | true |
01b6c2e3477d9a629364dfd8b9e36d74a2bcfdc3 | chesiy/erisk_LR | /main.py | UTF-8 | 2,869 | 2.640625 | 3 | [] | no_license | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.linear_model import LogisticRegression
import os
from utilities import process_across_usr
from ERDE_test import test_in_chunk, test_in_sample_v1, test_in_sample_v2
import numpy as np
impo... | true |
5d0f2960087a0e6ba3743068dce33edf23c1fded | Jara555/CNN-for-AD-classification | /EpochPerformance.py | UTF-8 | 3,215 | 2.859375 | 3 | [] | no_license | import numpy as np
from keras.callbacks import Callback
from sklearn.metrics import confusion_matrix, roc_auc_score
import config
class EpochPerformance(Callback):
"""
This callback class keeps track of the sensitivity, specificity, accuracy and AUC after each epoch.
This can be used for both the trainin... | true |
7e64abd78c464fdb8af19b041edc37965ed47a31 | alpharol/algorithm_python3 | /leetcode/0401-0500/0441.排列硬币.py | UTF-8 | 1,724 | 4.0625 | 4 | [] | no_license | #https://leetcode-cn.com/problems/arranging-coins/
"""
你总共有 n 枚硬币,你需要将它们摆成一个阶梯形状,第 k 行就必须正好有 k 枚硬币。
给定一个数字 n,找出可形成完整阶梯行的总行数。
n 是一个非负整数,并且在32位有符号整型的范围内。
示例 1:n = 5
硬币可排列成以下几行:
¤
¤ ¤
¤ ¤
因为第三行不完整,所以返回2.
示例 2:n = 8
硬币可排列成以下几行:
¤
¤ ¤
¤ ¤ ¤
¤ ¤
因为第四行不完整,所以返回3.
"""
# ************************************#
# *************s... | true |
ea3ff1f74b72ad194143e5b0481fa7ed4f3c7621 | Dugan91/ping_driver | /src/ping_emulator.py | UTF-8 | 370 | 2.765625 | 3 | [] | no_license | import pty
import serial
import os
import threading
import fcntl
master, slave = pty.openpty()
master_name = os.ttyname(master)
slave_name = os.ttyname(slave)
ser = serial.Serial(master_name, 115200, timeout = 2)
print("master: " + master_name)
print("slave: " + slave_name)
raw_input("Press enter to continue:")
w... | true |
f753ac24a1db1a8db19826b5b5c7c24b4bd1335b | huanghao/nose-xcase | /imgdiff/unpack.py | UTF-8 | 5,768 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
'''This script unpack a whole image into a directory
'''
import os
import sys
import errno
import argparse
from subprocess import check_call
from imgdiff.info import get_partition_info, FSTab
def mkdir_p(path):
'''Same as mkdir -p'''
try:
os.makedirs(path)
except OSError as ... | true |
000f9c17dccecc56144207c549bce8cb54bfd447 | shaadomanthra/cbpython-advanced | /day20/auth/models/RegisterModel.py | UTF-8 | 374 | 2.6875 | 3 | [] | no_license | from models.db import *
class RegisterModel:
def create(self):
conn = connect("app.db")
print("Database created")
def save(self,name,email,password):
conn = connect('app.db')
query = f"INSERT INTO users(name,email,password) VALUES('{name}','{email}','{password}')"
exec... | true |
ec3da0a8ee514d27186134388ab0aeaa6ef2bb7b | isaiahnields/algorithms | /leetcode/207. Course Schedule.py | UTF-8 | 931 | 3.03125 | 3 | [
"MIT"
] | permissive | class Solution:
def canFinish(self, numCourses, prerequisites):
"""
:type numCourses: int
:type prerequisites: List[List[int]]
:rtype: bool
"""
d = dict()
for p in prerequisites:
if p[0] in d:
d[p[0]].append(p[1])
else:
... | true |
8ae0443a99495bc884405053ae9c987d39e15f66 | Daehlie/python-hardway | /exercises/ex3.py | UTF-8 | 182 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
print "Hens", 25 + 30 / 6
print "Roosters", 100 - 25 * 3 % 4
print 3 + 3 + 1 - 5 + 4 % 2 - 1 / 4 + 6
print "Is it true that 3 + 2 < 5 - 7?"
print 3 + 2 < 5 - 7
| true |
408ad7d322e79fb970c67f1926963a5023568622 | wscholar/visualsearch | /hash_and_search.py | UTF-8 | 5,159 | 3.015625 | 3 | [] | no_license | # USAGE
# python hash_and_search.py --rawdataset rawdataset --cleandataset cleandataset
# import the necessary packages
from imutils import paths
import argparse
import time
import sys
import cv2
import os
import pprint
def dhash(image, hashSize=8):
# resize the input image, adding a single column (width) so we
# c... | true |
ddd9eaf27f7d136568f7d4e0aed4665c08f0d7f6 | Shea-wild/FTSE-100-text-to-speech | /FTSE100 json read mk1.py | UTF-8 | 663 | 2.578125 | 3 | [] | no_license | import urllib.request, json
from datetime import datetime
import time
url = "https://spreadsheets.google.com/feeds/list/0AhySzEddwIC1dEtpWF9hQUhCWURZNEViUmpUeVgwdGc/1/public/basic?alt=json"
with urllib.request.urlopen(url) as url:
data = json.loads(url.read().decode())
feed = data['feed']
entry = fee... | true |
8b848bdc515cf5915a73e268322d20dd65a28506 | GeorgesCH/SSDTeamProject | /healthapp/encryption.py | UTF-8 | 3,763 | 3.59375 | 4 | [] | no_license | """Module containing functions for encrypting/decrypting data.
Functions:
encrypt_medical_record -- encrypts a given medical record using the user key.
decrypt_medical_record -- decrypts a number of posts using the key.
encrypted_post -- encrypts a post using the recipient's key.
decrypt_post -- decryp... | true |
becdef962dd7498785ef57ec86cc2258858b15c7 | bouyuc/CMPE273-Assignment1 | /server.py | UTF-8 | 2,160 | 2.640625 | 3 | [] | no_license | import os
import sys
from flask import Flask, request
from werkzeug.utils import secure_filename
from pymongo import MongoClient
from bson.objectid import ObjectId
from io import StringIO
import contextlib
@contextlib.contextmanager
def stdoutIO(stdout=None):
old = sys.stdout
if stdout is None:
stdout ... | true |
ad5057a7a28a38a2c29618d54586a9562fa3e6cd | jamiewei-tw/cs50 | /practice/input_practice.py | UTF-8 | 714 | 4.1875 | 4 | [] | no_license | #!/usr/bin/python3
import calendar
while True:
try:
Year = int(input('Year: '))
if 1 <= Year <= 10000:
break
else:
print("Please Enter A Number Between 1 to 10000")
except:
print("Please Enter A Number")
while True:
try:
Month = int(in... | true |
4a9f64230d53cfaf3e8e95e7fc6b73d0bb4c46e4 | droundy/cpe | /impedance.py | UTF-8 | 3,732 | 2.75 | 3 | [] | no_license | from __future__ import division
import matplotlib, sys
if 'show' not in sys.argv:
matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
import compute
#Concentration of ions as function of distance
#
#Constants
k = 1.38e-23 #m^2kg/s^2K Boltzman Constant
T = 300 #room temp. Kelven
beta = 1/(k*T... | true |
c570ffb5c464ef4af8022128bc0be0aedec73a24 | mansukim1125/JudgeInterface | /JudgeInterface/lib/placeholder.py | UTF-8 | 1,096 | 2.59375 | 3 | [
"MIT"
] | permissive | from typing import Dict, List
import re
class Placeholder:
@staticmethod
def for_create_query(fields_len: int) -> str:
placeholder = ''
for i in range(fields_len):
placeholder += '?, '
placeholder = re.sub(', $', '', placeholder)
return placeholder
@staticmethod... | true |
a97e0cd0372c45bf263b1fb60a8037ee968c5fe9 | smjn/programs | /python/buy.py | UTF-8 | 1,260 | 2.640625 | 3 | [] | no_license | import base64
import sys
import os
import urllib2
import re
class BuyPhone:
def __init__(self):
self.url="https://www.amazon.in"
self.product="redmi+4a"
self.token="""dHUgY2h1dGl5YSBoYWk="""
self.result=""
def getSSLUrl(self, url):
return base64.b64decode('aHR0cDovL2dz... | true |
d2028a50a9d1b4c4b69b0782baf68c9af9e9ad54 | WSWCWaterDataExchange/MappingStatesDataToWaDE2.0 | /Nebraska/AggregatedAmounts/2_NEag_Variables.py | UTF-8 | 4,463 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | # Date Created: 05/02/2022
# Author: Ryan James (WSWC)
# Purpose: To create NE ag variable use information and populate a dataframe for WaDE_QA 2.0.
# Notes: 1) No input csv to read, all values are more easily hardcoded into a list here and then exported to CSV.
# Needed Libraries
####################################... | true |
b72d4de842ddbb785e0c77c75f281a059e20cec2 | danhey/thejoker | /thejoker/sampler/tests/test_likelihood.py | UTF-8 | 4,616 | 2.515625 | 3 | [
"MIT"
] | permissive | # Third-party
import astropy.units as u
import numpy as np
# Package
from ..likelihood import design_matrix, tensor_vector_scalar, marginal_ln_likelihood
from .helpers import FakeData
class TestLikelihood(object):
# TODO: repeated code
def truths_to_nlp(self, truths):
# P, M0, ecc, omega
P ... | true |
27b1ca7c988ae7918d9886c0ad386b38d5f29a9d | GGKorn/computational-semantics | /word2vecSimilarity.py | UTF-8 | 779 | 2.828125 | 3 | [] | no_license | # import modules & set up logging
import gensim
from hypernym import loadModel, reduceModel
#import logging
#logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
# class MySentences(object):
# def __init__(self, dirname):
# self.dirname = dirname
#
# def __iter... | true |
e28d6ae7f658dc3608e7dc96e53d0bb9304b1fb5 | ksuber/Udacity-intro-to-programming | /project4/videos.py | UTF-8 | 3,598 | 3.15625 | 3 | [] | no_license | import webbrowser
class Videos(object):
"""Creates an intialized video object.
Input:
title, plot and duration.
Behavior:
Creates a video object.
Attributes:
Title (str): Movie Title
plot (str): Movie Plot.
duration (str): Movie length.
... | true |
d8ad970cab026c74a7fb34abec3dcf18d16b4046 | lucrib/py3-pytest-testconfig-junitxml | /test_cases/conftest.py | UTF-8 | 708 | 2.625 | 3 | [
"MIT"
] | permissive | import pytest
@pytest.fixture(scope='session')
def setup_session(request):
"""
Setup session example.
:param request: ????
:return: None
"""
print('>>> setup_session')
def fin():
print('>>> teardown_session')
request.addfinalizer(fin)
def pytest_itemcollected(item):
par... | true |
7622e774c05c29f1f7d8d4d7870f9380f7f43720 | HyeJoonKim/Algorithm | /문자열/boj_9251_LCSx.py | UTF-8 | 352 | 3.25 | 3 | [] | no_license | first = input()
second = input()
arr = [[0] * (len(first)+1) for _ in range(len(second)+1)]
for i in range(len(second)):
for j in range(len(first)):
if second[i] == first[j]:
arr[i+1][j+1] = arr[i][j] + 1
else:
arr[i+1][j+1] = max(arr[i][j+1], arr[i+1][j])
prin... | true |
7ebbcc4bcfff9db34e63498f215315feacf17090 | 1019672401/browser | /main.py | UTF-8 | 3,147 | 2.53125 | 3 | [
"MIT"
] | permissive | import random
import socket
import sys
import os
import configparser
if hasattr(sys, 'frozen'):
os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH']
import pymysql
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtCore import QUrl, QTimer
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import ... | true |
135d17b216ca432ac5289ad33a7fd04b8ccce59a | TThomasV/CM2207-Introduction-to-the-theory-of-computation | /Task 3.py | UTF-8 | 249 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
import DFA
import sys
DFA_A = DFA.DFA(sys.argv[1])
DFA_B = DFA.DFA(sys.argv[2])
print("[!] Printing the symmetric differrence of {} and {}\n".format(sys.argv[1], sys.argv[2]))
DFA.symmetricDifference(DFA_A, DFA_B) | true |
b677a68025803342a583b580e17d531dd7f5d79e | thorDemo/ArticleDatabase | /tools/username.py | UTF-8 | 379 | 2.640625 | 3 | [] | no_license | from mylib.items import UserName
# usernames = UserName.select(UserName.name).order_by(UserName.id).limit(20)
# for it in usernames:
# print(it.name)
file1 = open('C:/Users/Administrator/Desktop/username.txt', 'r', encoding='utf-8')
temp = ''
for line in file1:
if 'person' in line:
temp = line.strip... | true |
01e3ae979f2ea3214e7981e6fa6750fcb87c91e7 | FWSquatch/tk-mosquitto | /tk1.py | UTF-8 | 1,480 | 3.796875 | 4 | [] | no_license | #!/usr/bin/python3
# Simple tkinter program that shows off some features
from tkinter import *
import time
import random
def getRand(): # Change the text of label1 to random number
k = random.randint(100,999)
label1.config(text=k)
j = 0 # global counter variable
def countUp(): # Change the text of label2 by ... | true |
4ac683c5dcaaa3ca1a4a73dadd515ff0265ce427 | bloodteller123/Simple-Search-Engine | /src/query_completion_module.py | UTF-8 | 881 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import json
# In[30]:
# modelPath = '../output/testBigramModel.json'
modelPath = '../output/bigramModel.json'
UomodelPath = '../output/UObigramModel.json'
limit = 6
#https://stackoverflow.com/questions/35624064/sorting-dictionary-descending-in-python
# In[35]:
d... | true |
8d20f67b4d55df706fde57673eb650777b993665 | dafinest/Student-assistant | /chatbot.py | UTF-8 | 6,188 | 2.65625 | 3 | [] | no_license | import numpy as np
import pickle
from keras.models import Model
from keras.layers import Input, LSTM, Dense
class Chatbot:
def __init__(self):
self.input_texts = 35
self.latent_dim = 256
self.max_encoder_seq_length = 82
self.max_decoder_seq_length = 254
self.charecter_inde... | true |
f904d8817c28a67f59288fcd96fd90ebcd94fafd | mnick900/CSE-Fixed- | /Quests.py | UTF-8 | 3,109 | 3.703125 | 4 | [] | no_license | """
order_amount = int(input("How many items are you getting"))
item_price = int(input("How much is the item you are getting?"))
state = str(input("What state do you live in?"))
tax = 1
cost = (order_amount * item_price)
if state == "Ca" or state == 'CA' or state == 'ca' or state == 'cA' or state == "California":
t... | true |
5742d0cd151b10154d4cdebdbebff2393c353d68 | he0119/iot-flask | /iot/api/resources/refresh.py | UTF-8 | 471 | 2.71875 | 3 | [
"MIT"
] | permissive | """Token Resource"""
from flask_restful import Resource
from flask_jwt_extended import (
create_access_token,
jwt_refresh_token_required, get_jwt_identity)
class Refresh(Resource):
"""Get(refresh_token_required): return token"""
@staticmethod
@jwt_refresh_token_required
def get():
"""... | true |
51bd0d93d31cf66f7ee9d38cb3af931d7946eeee | datademofun/goodreads-nyt-api-explorer | /scripts/nytimes/fetched/batch_bestseller_lists.py | UTF-8 | 2,696 | 2.671875 | 3 | [] | no_license | from bestseller_foo import fetch_list
from dateutil import rrule
from datetime import datetime, timedelta
from os import makedirs
from os.path import join, realpath
import json
import sys # for the exit
def generate_weekdate_strings(ymd_start, ymd_end):
dx = datetime.strptime(ymd_start, '%Y-%m-%d')
dy = dateti... | true |
91eb4404753a92ae3d0df920ae1eb7a19421afec | nathayush/CS-312 | /test/pa_3.py | UTF-8 | 161 | 2.984375 | 3 | [] | no_license | a =[5,6]
b = [7,8,9]
c = a+b
for element in c:
if c.index(element) == 0:
numb = element
else:
numb+=element
max_numb = numb
| true |
89fde5e64716efccbc73dbe8e27c5d49d018a3f5 | dimtsap/UQpy | /src/UQpy/Surrogates/PCE/polynomials/Hermite.py | UTF-8 | 1,437 | 3.25 | 3 | [
"MIT"
] | permissive | from UQpy.Surrogates.PCE.Polynomials import Polynomials
import numpy as np
from UQpy.Distributions import Normal
import scipy.special as special
class Hermite(Polynomials):
"""
Class of univariate polynomials appropriate for data generated from a
normal distribution.
**Inputs:**
* **degree** ('in... | true |
ac37c8d9336dd255f3387753c6b1d164b263debb | terryyin/CodingExercises | /pyGameOfLife/GameOfLife.py | UTF-8 | 2,012 | 3.46875 | 3 | [] | no_license | import unittest
from itertools import chain
def _numberOfAliveNeighbors(aliveCells, cell):
return len(aliveCells.intersection(neighborsOf(cell)))
def tick(aliveCells):
allNeighborsOfAliveCells = chain(*[neighborsOf(cell) for cell in aliveCells])
return [cell for cell in aliveCells if _number... | true |
e0581e419a3a7bc9fd55d6005f57b7d1d37aa5a0 | Aasthaengg/IBMdataset | /Python_codes/p02613/s070069452.py | UTF-8 | 252 | 3.34375 | 3 | [] | no_license | N = int(input())
s = [input() for i in range(N)]
'''
for v in ["AC", "WA", "TLE", "RE"]:
print("{0} x {1}".format(v, s.count(v)))
'''
print("AC x",s.count("AC"))
print("WA x",s.count("WA"))
print("TLE x",s.count("TLE"))
print("RE x",s.count("RE")) | true |
b3ca4e3a59fb16b2b7566c20b240f0eb9bcf93bf | pavel-kostyanov/sorting-algorithms | /merge_sort.py | UTF-8 | 742 | 3.875 | 4 | [] | no_license | def merge_sort(arr):
if len(arr) <= 1:
return arr
middle_index = len(arr) // 2
left_side = arr[: middle_index]
right_side = arr[middle_index :]
left_sorted = merge_sort(left_side)
right_sorted = merge_sort(right_side)
return merge(left_sorted, right_sorted)
def merge(left, right)... | true |
71f7156d761bc77a3ce274363eaf9f411af9e272 | choyan/intro-to-machine-learning-udemy | /logistic_regression_loan.py | UTF-8 | 463 | 3.28125 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
from sklearn.linear_model import LogisticRegression
# sigmoid function
# p(i) = 1 / (1 + exp[-(b0+b1*x)])
X = np.array([[10000, 80000, 35], [7000, 120000, 57], [100, 23000, 22], [223, 18000, 26]]) # balance, income, age
y = np.array([1, 1, 0, 0]) # if 1, they ... | true |
47b295835a047d5f58b605f381230e5d56b896b1 | Nghinh-Tri/CrawlingApp | /crawling/facility_detail.py | UTF-8 | 2,547 | 2.578125 | 3 | [] | no_license | from connection import connection
from bs4 import BeautifulSoup
from util import util
import logging
from googletrans import Translator
import validators
import mysql.connector
logger = logging.Logger('catch_all')
translator = Translator()
def get_specialty(symptom):
html = "https://en.wikipedia.org/wiki/" + symp... | true |
ddd07224d5fe21073edc09d16a31730b9d2d5560 | LeaoPastore/Carros | /fon.py | UTF-8 | 1,082 | 3.5625 | 4 | [] | no_license | disciplinas = [
[{"nome":"LTPI"},{"Joao": 2.5, "Maria": 8.9, "José": 6.7}],
[{"nome": "Copiladores"},{"Joao": 6.2, "Maria": 10, "José": 2.1, "Mario:": 6.9}],
[{"nome": "Tópicos Especiais"},{"Maria": 9.2, "José": 9.1, "Mario": 5.5, "Joao": 5}],
]
def notas (alunos):
for i in range(0,3):
try:
... | true |
42dd9cdd65a975e6d71725efd11a75c0d26cfc28 | dhartunian/project-euler | /euler24.py | UTF-8 | 462 | 3.578125 | 4 | [] | no_license | import numpy as np
import math
remainder = 999999
# Use the multipliers to remove the given indexed number from the
# [0,1,2,3,4,5,6,7,8,9] sequence and you'll get the number. (since 0
# is the first one, we ask for the 999,999th)
for i in reversed(np.arange(1,10)):
fact = math.factorial(i)
multiplier = math... | true |
349493f4c83bd9a5bbf01a7d6e7f36de7a61b3cc | ausaki/data_structures_and_algorithms | /leetcode/stream-of-characters/400495530.py | UTF-8 | 1,355 | 3.5625 | 4 | [] | no_license | # title: stream-of-characters
# detail: https://leetcode.com/submissions/detail/400495530/
# datetime: Fri Sep 25 16:48:07 2020
# runtime: 624 ms
# memory: 37.6 MB
class TrieTree:
END = '#'
def __init__(self):
self.root = {}
def add(self, s):
node = self.root
for c in s:
... | true |
ebcb244ec28566cff6e606ebc828eb442a7c7730 | virraaj/Crawler-robot | /qinitial.py | UTF-8 | 359 | 2.703125 | 3 | [] | no_license | from copy import deepcopy
def qinitial(n):
#value = [[[0]*4]*n for i in range(n)]
#action = [[None]*n for i in range(n)]
a = [0,0,0,0]
temp = []
value = []
for i in range(1,n+1):
temp.append(deepcopy(a))
for j in range(1,n+1):
value.append(deepcopy(temp))
return value
q = qinit... | true |
576219200b20dc79e4448d1e96c924a6b3c2c1f5 | ashutoshdhondkar/Liclipse-Workspace | /Imaging/Tut3.py | UTF-8 | 162 | 2.796875 | 3 | [] | no_license | from PIL import Image
img = Image.open('brett.png')
img.crop((10,10,300,300)).show()
# (top left,right bottom) same as rectangle(x1,y1,x2,y2) in C
del img | true |
7e28fd30e99f124dbad5233064d310962666748c | JIC-CSB/dtoolai | /scripts/apply_model_to_image.py | UTF-8 | 1,036 | 2.515625 | 3 | [
"MIT"
] | permissive | import click
import dtoolcore
from PIL import Image
from torchvision.transforms.functional import to_tensor
from dtoolai.imageutils import coerce_to_target_dim
from dtoolai.trained import TrainedTorchModel
def image_fpath_to_model_input(image_fpath, input_format):
im = Image.open(image_fpath)
# print(f"Ori... | true |
c71c8c63ee2f44596966baa4081b2d1d10df4fc9 | eightnoteight/compro | /codility/task1.py | UTF-8 | 237 | 3.09375 | 3 | [] | no_license | # you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(L):
# write your code in Python 2.7
count = 0
while L is not None:
count += 1
L = L.next
return count
| true |
c934e39f5fedaaa9381a6f6f3a11c7a67e8222aa | CabinfeverB/RotationNet-TensorFlow | /dataset.py | UTF-8 | 3,415 | 2.53125 | 3 | [] | no_license | # encoding: utf-8
'''
#author: Yongbo Jiang
#contact: cabinfeveroier@gmail.com
'''
import os
import numpy as np
import cv2
from config import config
CLASS_NUM = config.CLASS_NUM
VIEW_NUM = config.VIEW_NUM
class MultiViewDataset():
def __init__(self, data_dir, data_type):
self.x = []
self.y = [... | true |
7a1f37043a66659bb3c59c604bdec008603bf05e | Jeremias333/reconhecimento-imagem | /src/outros_parametros.py | UTF-8 | 785 | 2.75 | 3 | [] | no_license | import cv2
carrega_face = cv2.CascadeClassifier("haarcascades/haarcascade_frontalface_default.xml")
carrega_eye = cv2.CascadeClassifier("haarcascades/haarcascade_eye.xml")
image = cv2.imread("fotos/rostoolhos.jpg")
imagecinza = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faces = carrega_face.detectMultiScale(imagecinza... | true |
00a875e05810219648646978c33c4809a0bb4241 | chandanbateja/first-assignment | /ass5.py | UTF-8 | 1,398 | 4.1875 | 4 | [] | no_license | #Question 1
year=int(input("enter a year"))
if(year%4)==0:
print("it is a lear year")
else:
print("not a leap year")
#Question 2
length=int(input("enter the length"))
breadth=int(input("enter the breadth"))
if(length==breadth):
print("it is a sqare")
else:
print("it is a rectan... | true |
003685ceeda6af3d4fe604ed1db43bae4c7afd0b | pksvv/chatterbot-smalltalk5 | /talk/create_Small_Talk.py | UTF-8 | 847 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import json
import pandas as pd
def main():
with open('SmallTalk.json', encoding='utf-8') as json_data:
data = json.load(json_data)
print(data)
smalltalks=pd.read_excel("SmallTalk.xlsx")
response = []
for index, row in smalltalks.iterrows():
response.append(data[row['An... | true |
aa5f6c84872ceac0d4217c06444b2359886143a2 | kundankumar26/Home-Security-System | /3. face recognition.py | UTF-8 | 2,363 | 2.609375 | 3 | [] | no_license | ''''
Now the model recognizes the face in real time.
'''
import cv2
import numpy as np
import os
import email_test
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.read('trainer/trainer.yml') #loading trained model
cascadePath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier... | true |
8af5007f3af1829b26dc25b1abe79849db82b9ab | shivansh-nalwaya/devengers | /server/predit_model.py | UTF-8 | 21,083 | 2.578125 | 3 | [] | no_license | from sklearn.metrics import precision_score, recall_score, confusion_matrix
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import SGDClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
import numpy as np
import pandas as pd
import os
... | true |
21d82c9e1dafa9b8de80932a00adc96a6b13332c | EECS388-F19/lab-samarth-sarin | /helloworld.py | UTF-8 | 177 | 3.546875 | 4 | [] | no_license | import random
print("Samarth Sarin")
x = random.randint(0, 101)
y = random.randint(0, 101)
print(x)
print(y)
print("Sum ="),
print(x + y)
print("Average ="),
print((x + y)/2)
| true |
73d0ee2e1f81ec1d15f979b122f0392999c9ebf6 | xiciluan/YelpDataAnalysis | /Code/DataCleaning_Business/category_count.py | UTF-8 | 331 | 2.90625 | 3 | [] | no_license | import csv
from collections import defaultdict
ctg_cnt = defaultdict(int)
with open('category_biz.csv') as f:
reader = csv.reader(f)
for row in reader:
ctg_cnt[row[0]] += 1
with open('category_count.csv', 'w') as f:
writer = csv.writer(f)
for ctg in ctg_cnt:
writer.writerow([ctg, ctg_c... | true |
843edb56ece03a7de1f25fd272292447e5d609b2 | rjos/ris | /src/algorithm/instance_selection/regression/cnn.py | UTF-8 | 970 | 2.703125 | 3 | [] | no_license | import numpy as np
from .discretization import discretization
from ..classification.cnn import cnn
def tcnn(training, targets, alpha, model, nn):
n, m = training.shape
p = [0]
t = set(range(n))
for i in range(1, n):
instance = training[i, :].reshape(1, m)
target = targets[i]
# ... | true |
b343ee5d22fa395fe2cd68075cae004cf7e5195a | tonyyli/imapper2 | /halolist.py | UTF-8 | 1,788 | 3.015625 | 3 | [
"MIT"
] | permissive | import numpy as np
import warnings
"""
Class containing all halo properties
"""
class HaloList(object):
def __setattr__(self, name, value):
# Prevent assigning properties that have not been explicitly defined in __init__
if not hasattr(self, name):
warnings.warn("{:s} is not a defa... | true |
8731917d3860102622c89c6d402d96a480a80a17 | ebysofyan/django-server-side-datatable | /django_server_side_datatable/utils.py | UTF-8 | 225 | 3.890625 | 4 | [] | no_license | def list_to_dict(keys, values):
if len(keys) != len(values):
raise Exception("Keys and Values length not match")
result = {}
for i in range(len(keys)):
result[keys[i]] = values[i]
return result | true |
15c8e3f8f1b758e0d542aba2b4223573c8ff2cbc | QrCer/PyTest | /1-Python基础/1.3-使用list和tuple.py | UTF-8 | 843 | 4.5 | 4 | [] | no_license | # coding=utf-8
# list
# Python内置的一种数据类型是列表:list。list是一种有序的集合,可以随时添加和删除其中的元素。
list = ['a', 2,'c','d']
print list[0]
print list
print len(list)
# 获取倒数第一个元素
print list[-1]
# append 向数组末尾追加元素
list.append('x')
print list
# 向指定位置插入元素
list.insert(1,'aa')
print list
# 删除末尾元素
list.pop()
print list
# 删除指定位置元素
list.po... | true |
8c6178b7dddb6af4c2f3dd6176bc5f6f70c74054 | codybai/simple | /Sugar/Loss/LossLib/tv_loss.py | UTF-8 | 888 | 2.65625 | 3 | [] | no_license | import torch
import torch.nn as nn
class tv_(nn.Module):
def __init__(self):
super(tv_, self).__init__()
def forward(self, x):
x_right = x[:, :, 1:, 0:-1]
x_bottom = x[:, :, 0:-1, 1:]
x = x[:, :, 0:-1, 0:-1]
d_r = x_right-x
d_b = x_bottom-x
# return (d_... | true |
0d5b5f360128d89e4edc66bbdc425090312bf4db | Mahrokh-Eb/LA-college-Python | /average.py | UTF-8 | 240 | 3.375 | 3 | [] | no_license | # get as many as number till user doesn't enter, give the average!
import stdio
total = 0
count = 0
while not stdio.isEmpty():
value = stdio.readInt()
total += value
count += 1
print('Average is %.2f' %(total/ count)) | true |
f4f3b58b2163ca9069b81d596cb4d9a1712c04a3 | lastingyeh/Python-Note | /Science-Calculate/pandas_concat.py | UTF-8 | 1,180 | 3.3125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from util import s_print as p
df1 = pd.DataFrame(np.ones((3, 4)) * 0, columns=['a', 'b', 'c', 'd'])
df2 = pd.DataFrame(np.ones((3, 4)) * 1, columns=['a', 'b', 'c', 'd'])
df3 = pd.DataFrame(np.ones((3, 4)) * 2, columns=['a', 'b', 'c', 'd'])
p(df1, 'df1')
p(df2, 'df2')
p(df3, 'df3... | true |
56212cfc14269b7e9997464a3e0c22551c0b7ca3 | gadamsetty-lohith-kumar/skillrack | /Matrix Non-Border Elements Sum 27-10-2018.py | UTF-8 | 1,129 | 4.03125 | 4 | [] | no_license | '''
Matrix Non-Border Elements Sum
An integer matrix of size RxC is passed as the input to the program. The program must print the sum of elements which are not present in the border of the matrix.
Boundary Condition(s):
2 <= R,C <= 50
Input Format:
The first line contains the value of R and C separated by ... | true |
1a985c9148a029bc3b77e84988acb0383a499713 | sergeyrudov/py1h | /tada.py | UTF-8 | 597 | 3.28125 | 3 | [] | no_license | class Room:
def __init__(self, long=0.0, wightd=0.0, num_windows=0):
self.long = long
self.wightd = wightd
self.num_windows = num_windows
def get_area(self):
return self.long*self.wightd
def windows_quantity(self):
return self.num_windows
r = Room(5, 5, 1)
r2 = Room(6, 6, 2)... | true |
c9f38b93d5c0654f86123e5a1205a49b403e83bf | mas212/python-basic | /for.py | UTF-8 | 135 | 3.265625 | 3 | [] | no_license | orang = ['hari', 'edo', 'awid']
for nama in orang:
print('nama adalah', nama)
angka = [1,2,3,4,5]
for nilai in angka:
print(nilai) | true |
fdccb4468361b6bf4e067f63e7172f7a7d8117f8 | cliveward/AdventOfCode | /day6/test_mult_lists.py | UTF-8 | 91 | 2.78125 | 3 | [] | no_license | grid = [[0 for col_num in range(4)] for row_num in range(4)]
grid[1][1] = 1
print(grid)
| true |
9dde9e95cff2ae8ed219894e62c49f4e09370239 | TechPuppies/leetcode-python | /search_a_2d_matrix.py | UTF-8 | 3,232 | 4.03125 | 4 | [] | no_license | # coding=utf-8
# AC Rate: 31.2%
# SOURCE URL: https://oj.leetcode.com/problems/search-a-2d-matrix/
#
# Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
#
#
# Integers in each row are sorted from left to right.
# The first integer of each row is greater... | true |
b471735a5c20d957b2bfdfe5f3449945d9bce7b6 | thundree/MachineLearningUdemyA2Z | /Thompson_Sampling/thompson_sampling.py | UTF-8 | 1,023 | 2.96875 | 3 | [] | no_license | #Thompson algorithm
#import dataset
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#import dataset
dataset=pd.read_csv('E:\Machine_Learning_A_Z\Thompson_Sampling\Ads_CTR_Optimisation.csv')
#impleting Thompson Sampling
import random
N=10000
d=10
ads_selected=[]
numbers_of_rewards_1=[0]*d
numbe... | true |
755212c91164ff94668f6651c8355ad43dc55c5a | youarefree/fullstack-nanodegree-vm | /vagrant/catalog/populateDatabase.py | UTF-8 | 1,477 | 2.921875 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import Store, Base, Item, User
engine = create_engine('sqlite:///itemCatalog.db')
# Bind the engine to the metadata of the Base class so that the
# declaratives can be accessed through a DBSession instance
Base.metadata.b... | true |