blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
4fa2c2e79cee07cb0a16668b515674d2360a4389
Python
juliawarner/TEA-SeniorDesign
/Code/Testing/ControllerSocket_test.py
UTF-8
1,126
3.40625
3
[]
no_license
# TEA@UCF Senior Design Mechatronics Project # Julia Warner # Tests connection between Raspberry Pi and controller computer using sockets. #python library used to create sockets import socket #constants for IP addresses and port number RASPI_IP = '192.168.2.7' PORT_NUM = 14357 #create socket object connection = soc...
true
d0fb631207723870089eb8990e0bc4e178d78773
Python
Harshxz62/CourseMaterials
/SEM 5/Computer Networks/LAB/week5/PES1201800125_Tanishq_Vyas_WEEK5_Submission/TCPClient.py
UTF-8
391
3.328125
3
[]
no_license
#TCP Client from socket import * import sys serverName = sys.argv[1] serverPort = int(sys.argv[2]) clientSocket = socket(AF_INET, SOCK_STREAM) clientSocket.connect((serverName,serverPort)) sentence = input("Input lowercase sentence: ") clientSocket.send(str.encode(sentence)) modifiedSentence = clientSocket.recv(1024)...
true
87c86ae9689c7e19e1516c7a7793cf5ed3d490ab
Python
VachaArraniry/python_portfolio
/listbasic.py
UTF-8
501
4.46875
4
[]
no_license
fruits = ["apple", "durian", "strawberry", "orange"] # list literal print(len(fruits)) fruits.append("kiwi") # add an item to the list print(len(fruits)) print(fruits[1]) # get orange from the list print(fruits[3]) # get the last fruit from the list print(fruits[-1]) # simple version print(fruits[l...
true
e3e7bde92a428499e972dc3dbf95dcf70b6285b6
Python
vipulmjadhav/python_programming
/python_programs/file_handling/writeFile.py
UTF-8
113
3.125
3
[]
no_license
file = open('demo.txt','r+') file.write('program for writinng in file') for i in file: print(i) file.close()
true
adc8e46204d1c54c5d00622c20dd1ea307c5f069
Python
DaHuO/Supergraph
/codes/CodeJamCrawler/CJ/16_0_1_abhigupta4_Counting_Sheep.py
UTF-8
432
3.46875
3
[]
no_license
def counting_sheep(n): if n == 0: return "INSOMNIA" occur = set() temp = str(n) for ele in temp: occur.add(ele) count = 1 while (len(occur) != 10): count += 1 temp = n * count for ele in str(temp): occur.add(ele) return count for i in range(input()): N = input() if N == 0: print...
true
5eb93e10a99bfa513e9fcbb6cc1d5adb4858e0a2
Python
yuhanlyu/coding-challenge
/lintcode/route_between_two_nodes_in_graph.py
UTF-8
772
3.578125
4
[]
no_license
# Definition for a Directed graph node # class DirectedGraphNode: # def __init__(self, x): # self.label = x # self.neighbors = [] from collections import deque class Solution: """ @param graph: A list of Directed graph node @param s: the starting Directed graph node @param t: the t...
true
20e4ad56d3e6273cbd33a2cae0d47b9bc489f561
Python
ZAKERR/-16-python-
/软件第六次作业/软件162/2016021103李洋/图形练习.py
UTF-8
733
3.515625
4
[]
no_license
#import turtle #t=turtle.Pen() ''' #t.circle(50,steps=4) t.speed(5) turtle.goto(0,0) for i in range(4): turtle.forward(100) turtle.right(90) turtle.home() turtle.circle(50,270) ''' ''' import turtle t=turtle.Pen() t.speed(1000) for x in range(1000): t.circle(x) t.left(91) ''' '''...
true
d9ee09db1451c800249c4257d1d883019ed2bbec
Python
bc0403/EC2019
/Alexander-6th/pp_2p14.py
UTF-8
173
2.984375
3
[]
no_license
R1 = 10 R2 = 20 R3 = 40 Rsum = R1*R2 + R2*R3 + R3*R1 Ra = Rsum/R1 Rb = Rsum/R2 Rc = Rsum/R3 print(f"Ra, Rb, and Rc is {Ra:.4f}, {Rb:.4f}, and {Rc:.4f} ohm, respectively.")
true
6f14849a3e67e169f00fd581da04e2db71533c19
Python
dcohashi/IntroPython2015
/students/ericrosko/session07/test_html_render.py
UTF-8
3,385
3.015625
3
[]
no_license
import html_render as hr from io import StringIO import re # import regular expressions so I can strip spaces and \n's from text def test_instantiate(): e = hr.Element() def test_create_content(): e = hr.Element("stuff") assert e.content is not None def test_content_None(): e = hr.Element() print (e.content) ...
true
52d586eddcc1772e92c3c4e7d0ce140336db702c
Python
Jayant1234/Marsh_Ann
/marsh_plant_dataset.py
UTF-8
2,755
2.671875
3
[ "MIT" ]
permissive
import numpy as np import cv2 import csv import torch from torch.utils.data import Dataset from PIL import Image class MarshPlant_Dataset_pa(Dataset): def __init__(self, infile,transform=None): #initialize dataset self.imgfiles = [] self.anns = [] self.transform= transform ...
true
c5501f6d2d9984127876f628dbae91e0a39129d1
Python
pkaff/Simulation_Tools_Project_2
/task3.py
UTF-8
1,521
2.515625
3
[]
no_license
from numpy import cos, sin, array, zeros, arange from numpy.linalg import norm from scipy.optimize import fsolve from squeezer import * def gf(q): beta, gamma, phi, delta, omega, epsilon = q #beta = q[0] theta = 0 #theta = q[1] #gamma = q[1] #phi = q[2] #delta = q[3] #omega = q[4] ...
true
9d8586dc78a8818fcd44087c69c2da63267ea420
Python
diegoami/datacamp-courses-PY
/pandas_13/pandas13_2.py
UTF-8
204
2.53125
3
[]
no_license
import pandas as pd revenue = pd.read_csv('../data/revenue.csv') managers = pd.read_csv('../data/managers_2.csv') combined = pd.merge(revenue, managers, left_on='city', right_on='branch') print(combined)
true
f14e337fd43e126d0e1ae1496d0d67c79bd21a30
Python
Andyeexx/-algorithm015
/Week_06/621-task-scheduler.py
UTF-8
238
2.578125
3
[]
no_license
def leastInterval(self, tasks: List[str], n: int) -> int: mp=collections.Counter(tasks) all_task=list(mp.values()) all_task.sort() return max(len(tasks), (all_task[-1]-1)*(n+1)+all_task.count(all_task[-1]))
true
8e83c3085dfd0fe041e51613cca55e3254e48266
Python
VitamintK/AlgorithmProblems
/leetcode/b38/c.py
UTF-8
850
3.03125
3
[]
no_license
from collections import defaultdict class Solution: def countSubstrings(self, s: str, t: str) -> int: tstrings = defaultdict(int) for i in range(len(t)): for j in range(i+1, len(t)+1): tp = t[i:j] # for k in range(len(tp)): # tstrings.a...
true
f638f245473224874feb74cba595299153f9a54e
Python
samudero/PyNdu001
/RootFinding.py
UTF-8
1,828
4.03125
4
[]
no_license
# Root Finding [202] """ Created on Fri 23 Mar 2018 @author: pandus """ # ------------------------ Using bisection algorithm from scipy from scipy.optimize import bisect def f(x): """returns f(x) = x^3 - 2x^2. Has roots at x = 0 (double root) and x = 2""" return x ** 3 - 2 * x ** 2 # Main prog...
true
5f7153e6f48499a0f2b5be730e9490f333e541eb
Python
cleuton/pythondrops
/curso/licao5/semexcept.1.py
UTF-8
91
2.96875
3
[ "Apache-2.0" ]
permissive
try: a=open('arquivo.txt') print(a.read()) except: print('Arquivo inexistente')
true
87d66b4a6ab3057f9b758222aedb7add9e10c6eb
Python
uhh-lt/taxi
/graph_pruning/methods/m_hierarchy.py
UTF-8
7,296
2.578125
3
[ "Apache-2.0" ]
permissive
import networkx as nx import methods.util.write_graph as write_graph import methods.util.util as util from .zhenv5.remove_cycle_edges_by_hierarchy_greedy import scc_based_to_remove_cycle_edges_iterately from .zhenv5.remove_cycle_edges_by_hierarchy_BF import remove_cycle_edges_BF_iterately from .zhenv5.remove_cycle_edge...
true
9171964e9f9946b2078d7435ff1148b91dd64153
Python
degerli/qcc
/src/lib/tensor_test.py
UTF-8
1,121
2.671875
3
[ "Apache-2.0" ]
permissive
# python3 from absl.testing import absltest from src.lib import tensor class TensorTest(absltest.TestCase): def test_pow(self): t = tensor.Tensor([1.0, 1.0]) self.assertLen(t.shape, 1) self.assertEqual(t.shape[0], 2) t0 = t.kpow(0.0) self.assertEqual(t0, 1.0) t1 = t.kpow(1) self.ass...
true
be7524f0580fb95cb7e2ef363032afdacea6ca7a
Python
dodoyuan/leetcode_python
/剑指offer/51_构建乘积数组.py
UTF-8
524
3.234375
3
[]
no_license
# -*- coding:utf-8 -*- class Solution: def multiply(self, A): # write code here if len(A) < 2: return A length = len(A) B = [1 for _ in range(length)] tempB = [1 for _ in range(length)] for i in xrange(1, length): B[i] = B[i-1] * A[i-1] ...
true
551a9b9faee8dc5a81bff74fd55caa31ad70e748
Python
yashpatel3645/Python-Apps
/Youtube Video Downloder/Single Video Downloader.py
UTF-8
426
2.609375
3
[]
no_license
from pytube import YouTube Save_Path = "D:/Youtube Downloaded Video" link = input("Enter the Link : ") try: yt = YouTube(link) except: print("Connection Problem....!!!") # print(yt.streams.all()) mp4file = yt.streams.get_highest_resolution() print("Please Wait Your video is being downloading.......") try: ...
true
85876c896946f1f1eb43c5b5cc5241a637a20108
Python
wankhede04/python-coding-algorithm
/arrays/fill-blanks.py
UTF-8
298
3.15625
3
[]
no_license
array1 = [1,None,2,3,None,None,5,None] def solution(nums): valid = 0 res = [] for i in nums: if i is not None: res.append(i) valid = i else: res.append(valid) return res print(solution(array1))
true
f55c1e363c4d64728bbcc8b7544aef56a268519a
Python
oikkoikk/ALOHA
/important_problems/1541_lost_bracket.py
UTF-8
539
3.6875
4
[]
no_license
string = input().split('-') # -를 기준으로 식 분할 # ex. 60-30+29-90-10+80 -> ['60', '30+29', '90', '10+80'] # 따라서 맨 처음 원소만 더해주고, 나머지는 계속 빼주면 된다 num = [] result = 0 for token in string: tempSum = 0 if token.find('+'): pl = token.split('+') # + 연산 직접! for temp in pl: tempSum += int(temp) ...
true
b99e6948b3ae4e59344c6942524e8d9071311d76
Python
abiraja2004/IntSys-Sentiment-Summary
/bert_finetune/BERTEval.py
UTF-8
3,570
2.578125
3
[]
no_license
import pandas as pd import numpy as np import torch from torch.utils.data import (DataLoader, RandomSampler, SequentialSampler, TensorDataset) from tqdm import tqdm, trange from pytorch_pretrained_bert.tokenization import BertTokenizer from pytorch_pretrained_bert.modeling import BertForS...
true
174179c73c6887743f8c70a9f0d80376b04079c7
Python
LaurenM2918/362-Sprint_Final
/Collab_Filter.py
UTF-8
7,884
3.265625
3
[]
no_license
# =============================DATA PREPARATION ============================== # ============================================================================ # Imports dataset import numpy as np import pandas as pd # Load dataset data = pd.read_csv('tmdb_5000_credits.csv') data.head() # Load second dataset data2 = pd....
true
c6f5c5c93f30ea2c08ee59a85f9f8b2a34f31c93
Python
Gitlittlerubbish/SNS
/exe9_1.py
UTF-8
98
2.671875
3
[]
no_license
#! usr/bin/python3 import numpy as np even_num_array = np.arange(0, 12, 2) print(even_num_array)
true
6ede7cd44626d1270c8bd7dfc64591f8fbc9fca4
Python
treejames/mt-assignments
/hw2/decoder/decode_lagrange
UTF-8
4,961
2.546875
3
[]
no_license
#!/usr/bin/env python import optparse import sys import models from collections import namedtuple # Helper adapted from grade.py def bitmap(sequence): """ Generate a coverage bitmap for a sequence of indexes """ return reduce(lambda x,y: x|y, map(lambda i: long('1'+'0'*i,2), sequence), 0) optparser = optparse.O...
true
e9f5bb1f47e00fe1d70f7314c3ac623fb2ccc941
Python
Pro4tech/Machine-Learning
/Basics/import.py
UTF-8
351
2.84375
3
[]
no_license
import tensorflow as tf import cv2 import matplotlib as plt from time import sleep #Sleep Function is seletively being imported from the time Library for i in range(5): print(i) sleep(5) #delay of 5 seconds print(tf.__version__) #Version Check print(cv2.__version__) #Version Check print(plt.__v...
true
daf9eb0deb94ea7d813c2a3f33a1896c52d18488
Python
wangzi2000/factor
/UMD/coding/王俊杰-coding-1.py
UTF-8
7,718
2.65625
3
[]
no_license
import numpy as np import pandas as pd import warnings warnings.filterwarnings('ignore') #导入文件 file = pd.read_csv('e658fe9354eaef36.csv', sep=',') df = pd.DataFrame(file) #df1 = df.head(30000) df1 = df dict_date = list(set((df1['date'].values))) dict_date.sort() #df为可用数据集 -- 未处理缺失值 df2 = df1[['date','PRC','PERMNO',"...
true
88abfd42ca93ecca3d50b27e51e005160228d0c3
Python
AlexeyZavalin/algorithm_python_learn
/lesson-1/task-5.py
UTF-8
170
3.515625
4
[]
no_license
number = int(input("Введите номер буквы в английском алфавите: ")) + 96 symbol = chr(number) print(f"Ваша буква - {symbol}")
true
4943bd6c69773653b787add67dc40e9e357bdeee
Python
codecandiescom/TechFramework-1.2
/scripts/ftb/Carrier.py
UTF-8
2,151
2.625
3
[]
no_license
# Carrier # March 27, 2002 # # by Evan Light aka sleight42 # # All rights reserved # Permission to redistribute this code as part of any other packaging requires # the explicit permission of the author in advance. ############################################################################## from Registry im...
true
f1c5b8942613795a8d72eec5ecf328173e5b8747
Python
anaypaul/LeetCode
/UniqueMorseCodeWords.py
UTF-8
735
3.359375
3
[]
no_license
class Solution: def uniqueMorseRepresentations(self, words): """ :type words: List[str] :rtype: int """ ll = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."] ...
true
3b72bcf8d60e174c6c798ac835bb5a49a96b8d09
Python
DaniilHryshko/QA_SELENIUM
/Основные методы/exmple.py
UTF-8
628
2.875
3
[]
no_license
from selenium import webdriver from time import sleep import math browser = webdriver.Chrome() link = "http://suninjuly.github.io/redirect_accept.html" def calc(x): return str(math.log(abs(12 * math.sin(int(x))))) browser.get(link) button = browser.find_element_by_tag_name("button.trollface") button.click() seco...
true
8fe64673805e64179e85fe21e23ec7fc56881442
Python
CMEI-BD/ml
/python-ml/hello.py
UTF-8
976
2.546875
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri May 11 11:14:36 2018 @author: meicanhua """ import tensorflow as tf import input_data sess = tf.Session() mnist = input_data.read_data_sets('MNIST_data', one_hot=True) #sess = tf.InteractiveSession() x = tf.placeholder("float", shape=[None, 784]) ...
true
e3623b8a82b610a57bbb3c2de62d420327591ec1
Python
MDBarbier/Python
/machine_learning/ML-AZ/Part 1 - Data Preprocessing/DataPreProcessingTemplate.py
UTF-8
950
3.328125
3
[]
no_license
# -*- coding: utf-8 -*- """ Data Preprocessing Template - Created on Friday Dec 6 2019 @author: matth """ #Import required libraries import pandas as pd from sklearn.model_selection import train_test_split #### Parameters columnsToRemove = -1 dependantVariableVector = 3 datafilePath = 'Data.csv' testSize = 0.2 ...
true
4b1e7efb58938740aa5c3b732e9cb4dbe420cc2a
Python
hufi1/PassGen-with-Tkinter
/PassGen.py
UTF-8
8,778
2.78125
3
[]
no_license
##################################################### ### hier entsteht mein eigener Passwort-Generator ### ### Hufi ### ### 21/06/2020 ### ##################################################### #################################################...
true
3aba9607d72b0c6d5d01d1dd45f825f8ef7313cb
Python
JRai-de/ProtectoJuegoPython1
/DuckHuntV1.py
UTF-8
5,001
2.859375
3
[]
no_license
# Librerias Necesarias. import random import os import background import pygame VidaJugador = 4 Puntuacion = 00 Animales = ['patito', 'pato1', 'bomb', 'b', 'd'] width = 1000 height = 620 Fps = 15 pygame.init() pygame.display.set_caption('MataPato') gameDisplay = pygame.display.set_mode((width, height)) clock = pygame...
true
4f7d299be425ddb8126d461abe4c4bc815df16bf
Python
goudarzi8/boston_housing
/exploredata.py
UTF-8
1,041
3.546875
4
[]
no_license
import pandas as pd #Importing pandas to use analytical tools from sklearn.datasets import * from sklearn.linear_model import LinearRegression # Applying simple regression analysis data = pd.read_csv('data/data.csv') # loading the data file print("MIN Value for each Attribute is") print(data.min()) print("First...
true
62381c409a602d23a9ca7bf594bbb20ec45b7d48
Python
mkgharbi/ST5-EI-Simulation
/mainPerformanceSimulation.py
UTF-8
8,933
3.078125
3
[]
no_license
from Machine import Machine from SharedFunctions import * from System import System from Buffer import * from indicateurs_de_performance import * MAXSIMULATIONBUFFERINCREMENTED = 50 def creationSystemCommonBuffer(numberMachine, machineTable, bufferTable): for i in range(numberMachine-1) : bufferTable.appen...
true
02bd92de642ab13124c137fff14587464b44a4e2
Python
denisov93/AA-20-21
/assignment1/TP1.py
UTF-8
9,120
3.3125
3
[]
no_license
''' Assignment 1 by Alexander Denisov (44592) Samuel Robalo (41936) AA 20/21 TP4 Instructor: Joaquim Francisco Ferreira da Silva Regency: Ludwig Krippahl ''' ''' TP1 Test & Train File contents Features(4) + ClassLabels(1): 1) Variance 2) Skewness 3) Curtosis 4) Entropy 5) Class Label [0=RealBankNotes & 1=FakeBankNot...
true
4c1045e7200900fc5a26de967882b89c4679bee6
Python
hannbusann/fw_xbot_zdzn
/src/xbot_s/script/input_keypoint.py
UTF-8
3,061
2.515625
3
[]
no_license
#!/usr/bin/env python #coding=utf-8 import rospy, sys, termios, tty import yaml from geometry_msgs.msg import Pose, PoseStamped from visualization_msgs.msg import Marker, MarkerArray from move_base_msgs.msg import MoveBaseActionResult class office_lady(): """docstring for office_lady""" def __init__(self): self....
true
27d2d269a43c902e4bfce748b308e5a102d5ce5c
Python
murakami10/atc_python
/not_solved/03/abc188_do______________________________________イモス法.py
UTF-8
517
2.8125
3
[]
no_license
from typing import List from typing import Tuple N, C = map(int, input().split()) events: List[Tuple[int, int]] = [] for _ in range(N): a, b, c = map(int, input().split()) a -= 1 events.append((a, c)) events.append((b, -c)) events.sort(key=lambda x: x[0]) top: int = 0 ans: int = 0 tmp: int = 0 fo...
true
c70030a22976f3db3ee39070003b158aa16c5b45
Python
Skar0/proba
/codes/Histogrammes.py
UTF-8
1,362
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import unicode_literals import matplotlib.pyplot as plt from numpy.random import normal from numpy.random import randn #On prend les lignes, fait un tableau pour chaque ram et chaque nombre d'acces currentFirstColVal = 10 data = [[0 for x in range(4)] for x in range(1000)] i = ...
true
d6239065f962ffbb0cc2683a5de5e98aa741fa12
Python
samgeen/hackandslash
/src/CmdVars.py
UTF-8
589
2.640625
3
[]
no_license
''' Created on 2 Mar 2014 @author: samgeen ''' import Animals class Player(object): def __init__(self): self._name = "punk" def Name(self, newname=None): ''' If newname is not None, set the Player's name to newname Return: player's name ''' if not newna...
true
d3608c993b1c44d3bddc8c3a6e14e8f14c6ad5a9
Python
noobwei/moeCTF_2021
/Reverse/Realezpy/EZpython.py
UTF-8
931
2.5625
3
[]
no_license
import time #flag = 'moectf{Pyth0n_1s_so0o0o0o0_easy}' c = [119, 121, 111, 109, 100, 112, 123, 74, 105, 100, 114, 48, 120, 95, 49, 99, 95, 99, 121, 48, 121, 48, 121, 48, 121, 48, 95, 111, 107, 99, 105, 125] def encrypt(a): result = [] for i in range(len(a)): if ord('a') <= ord(a[i]) <= ord('z'): ...
true
e829dd55ec71e0e17246c1929f5f959ea1529491
Python
openstax/pdf-distribution
/app/src/config.py
UTF-8
2,618
2.875
3
[ "MIT" ]
permissive
import boto3 class Config(object): def __init__(self, region_name, table_name): self.region_name = region_name self.table_name = table_name configs = Config.get_configs_from_dynamodb( region_name=self.region_name, table_name=self.table_name, ) ## T...
true
3df6186f8b9ce51265925bc60ff3615170c5d008
Python
carlacarov/d-wave-projects
/quantum-svm-toy.py
UTF-8
4,226
2.890625
3
[]
no_license
import dimod import neal import numpy as np import itertools as it import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.svm import SVC x = np.array([[-6,2],[-2,2],[2,2],[5,2]]) y = np.array([1,1,-1,-1]) plt.scatter(x[:, 0], x[:, 1], marker='o', c=y, s=25, edgecolor='k') model = SVC(...
true
3877f8a3a04281f6476dfc3e09d244cf95204ec5
Python
linuxhenhao/python-scripts
/dpkgPackage.py
UTF-8
10,193
2.765625
3
[]
no_license
#!/usr/bin/env python #-*- coding: utf-8 -*- ################################################### #Using dpkg.log to get what packages are installed #Because apt.log will miss packages dealed by dpkg #command ################################################### import os import time #packages that will be triggered ev...
true
70c53241bed1fe676f5068bef2db226f237e6723
Python
militska/coursera-soup
/index.py
UTF-8
948
3.40625
3
[]
no_license
import requests from bs4 import BeautifulSoup def exec(): for page_number in range(1, 92): req = requests.get('https://www.coursera.org/directory/courses?page=' + str(page_number)) html = req.text soup = BeautifulSoup(html, 'lxml') list_courses = soup.find('div', {"class": "rc-Link...
true
00fed5caf9eafd6d6a582c3e47b83b4beccbe12d
Python
axelkennedal/kexjobbet
/playground/machine_learning/SVM/breast_cancer_custom.py
UTF-8
536
2.875
3
[]
no_license
import pandas as pd import SVM import numpy as np df = pd.read_csv('../test_data/breast-cancer-wisconsin.data') df.replace('?', -9999, inplace=True) df.drop(['id'], 1, inplace=True) fullData = df.astype(float).values.tolist() dataDict = { -1: np.array([[1, 7], [2, 8], ...
true
b809ff8e39cae08874b69ae0b7dcd9a66ca15cfb
Python
skaurl/baekjoon-online-judge
/1105.py
UTF-8
233
2.828125
3
[]
no_license
n,m = map(str,input().split()) ret = 0 if len(n) != len(m): print(0) else: for i in range(len(n)): if n[i] == m[i]: if n[i] == '8': ret += 1 else: break print(ret)
true
a189183c02c65cbd431c0a0955827b1bbb2576dd
Python
prathamesh-mutkure/python-learn
/GUI/turtle_events/main.py
UTF-8
609
4.15625
4
[]
no_license
from turtle import Turtle, Screen def move_forwards(): turtle.forward(10) def move_backwards(): turtle.backward(10) def move_clockwise(): turtle.setheading(turtle.heading() - 5) def move_counter_clockwise(): turtle.setheading(turtle.heading() + 5) def clear(): turtle.clear() turtle.pen...
true
a9ac6e9cf6a4c446a53f02a72a1976b1962eae84
Python
lopezpdvn/pydsalg
/pydsalg/datastruct/heap.py
UTF-8
742
3.546875
4
[ "MIT" ]
permissive
def heapsort0(a): def heapify(a): count = len(a) ilastnode = len(a) - 1 start = (ilastnode - 1) // 2 while start >= 0: trickle_down(a, start, count) start -= 1 def trickle_down(a, start, count): root = start while root * 2 + 1 < count: ...
true
bf4f9445d1c66fcd633abdc346b98da7c03a2a6c
Python
MuskanValmiki/Dictionary
/w3_Q23.py
UTF-8
338
3.4375
3
[]
no_license
item_list=[{'item': 'item1','amount': 400}, {'item': 'item2', 'amount': 300}, {'item': 'item1', 'amount': 750},{'item':'item2','amount':100}] d1={} sum=0 sum1=0 for i in item_list: if "item1" in i["item"]: sum=sum+i["amount"] d1["item1"]=sum else: sum1=sum1+i["amount"] d1["item2"...
true
12dba68f7c98a23ffd533221f9d7efb039c62fa7
Python
chloeward00/Python-Flask-Web-Apps
/Book-Reviewing-Web-App/final-flaskVersion/app.py
UTF-8
9,252
2.609375
3
[]
no_license
import json from flask import Flask, render_template, url_for, request, redirect, flash from flask_sqlalchemy import SQLAlchemy from datetime import datetime from flask_login import login_user, current_user, logout_user, LoginManager, UserMixin # Forms Page take classes from file formsPage from formsPage import LoginFo...
true
c737e0fd6f36383dc04349246f7e0accec6bdff4
Python
navjotk/error_propagation
/plot_gradient_multi_nt.py
UTF-8
2,665
2.890625
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt import numpy as np import tikzplotlib import click @click.command() @click.option('--gradient-results-file', help='File containing gradient results') @click.option('--direct-results-file', default="direct_compression_results.csv", help='File containing direct compre...
true
1ec1dec68afb675a743eaefbfa7535addb0b2ed5
Python
YOOY/leetcode_notes
/problem/permutations.py
UTF-8
848
3.375
3
[]
no_license
from copy import deepcopy def permute(nums): limit = len(nums) result = [] backtracking(nums, [], limit, result) return result def backtracking(nums, container, limit, result): if len(container) == limit: result.append(deepcopy(container)) return container for i in nums: ...
true
b091773ab37b6f0e9134226192d1610b0dd5cd38
Python
mich2k/OOP
/Python/M2/set.py
UTF-8
1,027
3.609375
4
[]
no_license
def basics(): print(type({})) # {} is also the operator for dics, indeed this will print out dictionary print(type({1})) my_set = {1} my_set.add(2) my_set.update([2, 4, 5]) # the 2 is already in the set, it will guarantee the uniqueness indeed print(my_set) my_set.discard(2) # if there...
true
74844e5fa28ee916ebf58e517729ff860d5fc9c3
Python
Oscaria/stock-prediction
/代码/个股走势预测/newsMatrix.py
UTF-8
2,056
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Nov 24 22:35:04 2019 @author: wuzix """ import pandas as pd import numpy as np import json import csv labels = json.loads(open('../新闻事件分类器/训练结果/trained_results_1594750510/labels.json').read()) #file='D:\\毕业设计\\代码\\newtry\\新闻事件预测\\格力新闻矩阵.csv' col=[] col.append('日期') for i i...
true
c64eb9f1a53459d7dfe298a1f018bce3ae9280b3
Python
bhavana10/InstaBot
/instabot.py
UTF-8
19,088
2.984375
3
[]
no_license
import requests,urllib from textblob import TextBlob from textblob.sentiments import NaiveBayesAnalyzer ''' GLOBAL VARIABLE TO STORE BASE URL AND ACCESS TOKEN OF THE USER. ''' APP_ACCESS_TOKEN = '1718452521.5a7caf4.ff77bf36d87b4737911ee28c72a5c190' BASE_URL = 'https://api.instagram.com/v1/' ''' FUNCTION DECLARATION...
true
80df4033ba15ac98d8345d89ed7c25acf2e66e1f
Python
chainsmokers-hackaton/IoT-Service-Vendor-Server
/ServerApp/DBWrapper.py
UTF-8
1,347
2.578125
3
[]
no_license
import sqlite3 SELECT_QUERY_BASE = "SELECT * FROM %s" SELECT_MOBILE_TOKEN_BY_CLIENT_ID = SELECT_QUERY_BASE + " WHERE client_id='%s'" SELECT_CLIENT_ID_BY_AP_UUID = SELECT_QUERY_BASE + " WHERE ap_uuid='%s'" SELECT_AP_IP_PORT_BY_AP_UUID = SELECT_QUERY_BASE + " WHERE ap_uuid='%s'" class DBWrapper: def __init__(self, ...
true
7211e03cc680eeddcdaa28edd1feb569e5177856
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2983/59140/290380.py
UTF-8
437
3.15625
3
[]
no_license
n=int(input()) s=input() temp=0 for i in s: if s.count(i)%2==1:temp+=1 if temp%2==0 and temp!=0: print("Impossible") else: step=0 while len(s)>1: if s.count(s[0:1])==1: step += len(s) // 2 s=s[len(s)//2:len(s)//2+1]+s[1:len(s)//2]+s[0:1]+s[len(s)//2+1:] else: ...
true
0cb6b7a1bed0a7998e1a7b1470ddea2dd55ba652
Python
s-Akhil-krishna/Competitive-coding
/GeeksforGeeks/Anagram of String.py
UTF-8
318
2.84375
3
[]
no_license
from collections import Counter def remAnagram(str1,str2): cnt1 = Counter(str1) cnt2 = Counter(str2) ans = 0 for x in cnt1: if cnt1[x] > cnt2[x]: ans += cnt1[x] - cnt2[x] for x in cnt2: if cnt2[x] > cnt1[x]: ans += cnt2[x] - cnt1[x] return ans
true
d4a5faf6472c551f3cd8b3d398ed38cc1da0029f
Python
yang03265/jason
/networking/rip router/rip_router.py
UTF-8
6,866
2.875
3
[]
no_license
from sim.api import * from sim.basics import * ''' Create your RIP router in this file. ''' class RIPRouter (Entity): def __init__(self, tablea = None): # Add your code here! self.table = {} # routing table key: destination -> Value: secondHashMap. secondHashMap: key: firstHop -> Value: distance ...
true
9dc2b50c3bd606a4b2af5b41e404b950d7a315d1
Python
bansheerubber/dungeon-generator
/generator.py
UTF-8
7,201
2.734375
3
[]
no_license
import time import random import math from file import File from roomtype import RoomType from PIL import Image from room import Room from chunk import get_chunk from a_star import a_star class Generator: def __init__(self): self.room_types = [] self.difficulties = [] self.difficulties_map = {} self.reset() ...
true
7e3c56cbb6bd986d947267fcb722cfbd2167a881
Python
egeyosunkaya/floppy-birdie
/src/game.py
UTF-8
5,247
2.84375
3
[]
no_license
import pygame import logging import random from enum import Enum from pygame import init from pygame.math import Vector2 from pygame import Rect from commands import JumpCommand from background_state import BackgroundState from bird_state import BirdState from global_vars import GlobalVars from collision_checker impo...
true
060f447f63d51c86feb6ea26b90a0bf08cd0950f
Python
joostlek/python_school
/Practice Exercise 1/Practice Exercise 1_3.py
UTF-8
171
2.515625
3
[]
no_license
a = 6 b = 7 c = (6 + 7) / 2 inventaris = ['papier', 'nietjes', 'pennen'] voornaam, tussenvoegsel, achternaam = 'Joost', '', 'Lekkerkerker' mijnnaam = voornaam + achternaam
true
56855f70448ed1f4b0a2a84f20fc7892c4f7d64e
Python
jinju-lee/Python-study
/05-13plus.py
UTF-8
62
2.65625
3
[]
no_license
import re r= re.compile("a.+c") print(r.search("abbfffc"))
true
38ea932382f7d33ea64a42d53ded985510e9ff36
Python
heqiangsc/article_spider
/article_spider/spiders/cnblog.py
UTF-8
2,223
2.515625
3
[]
no_license
import re import scrapy import datetime from scrapy.http import Request from urllib import parse from article_spider.items import CnBlogArticleItem, ArticleItemLoader from article_spider.utils.common import get_md5 class CnBlogSpider(scrapy.Spider): name = "cnblog" allowed_domains = ["www.cnblogs.com"] st...
true
c157fd1ceee0495d1f8659c83b2aee30d5bff6e0
Python
84ace/esp32_smart_keezer
/software/old_stuff/other/i2c_scanner.py
UTF-8
3,134
2.890625
3
[ "MIT" ]
permissive
# Scanner i2c en MicroPython | MicroPython i2c scanner # Renvoi l'adresse en decimal et hexa de chaque device connecte sur le bus i2c # Return decimal and hexa adress of each i2c device # https://projetsdiy.fr - https://diyprojects.io (dec. 2017) import machine from time import sleep i2c = machine.I2C(scl=machine.Pin...
true
749acd62e9c8bc2a2ec6824d46fbb6b798802961
Python
xueshijun/0.MachineLearningWorkSpace
/MachingLearningInAction/com/MapReduce/mpMeanMapper.py
UTF-8
1,246
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------- #Name : #Author : Xueshijun #MailTo : xueshijun_2010@163.com / 324858038@qq.com #QQ : 324858038 #Blog : http://blog.csdn.net/xueshijun666 #Created on Thu Mar 03 09:26:08 2016 #Version: 1.0 #-------------...
true
2fbdafa2fc90337cb1e5febee126ba42c2ac4241
Python
ZarulHanifah/index_combination_software
/game.py
UTF-8
4,417
2.828125
3
[]
no_license
import sys import pygame from index_combination.world_constants import * import index_combination.support_functions as sf class Game: def __init__(self): pygame.init() pygame.display.set_icon(pygame.image.load(LOGO_PATH)) pygame.display.set_caption(SOFTWARE_CAPTION) self.surface = pygame.display.set_mode((WI...
true
292565acd11e3c3c17bb5a458bcf9ae43a7b3849
Python
FWWorks/Assn1_DSP
/logger.py
UTF-8
1,323
2.90625
3
[]
no_license
import logging loggers = {} def get_logger(log_file): # create logger logger_name = log_file if logger_name in loggers: return loggers[logger_name] logger = logging.getLogger(logger_name) logger.setLevel(logging.INFO) # create file handler log_path = log_file fh = logging.Fil...
true
3d113871439e4e9451c2976d378315d2f7e5ed99
Python
razib764/Treelib
/boxplots.py
UTF-8
1,095
3.546875
4
[]
no_license
""" The following method creates boxplots of the variance of data for the number of nodes for 10 different birthrates with fixed maximum time over 100 iterations per birth rate """ import dendropy import matplotlib.pyplot as plt from ete3 import Tree, TreeStyle def box_plot(): birth_rate = 0.2 #initial vaue de...
true
a57234e7c510a643f5051b3f7936fec196567043
Python
Jordan-Voss/CA117-Programming2
/middle_011.py
UTF-8
225
3.453125
3
[]
no_license
import sys def mid(s): if len(s) % 2 != 0 : return (s[len(s) // 2]) else: return ('No middle character!') def main(): for line in sys.stdin: ml = mid(line.strip()) print(ml) if __name__ == '__main__': main()
true
f16c9c9092e0b9d828e3e7ff0e619d3dab42cde2
Python
mcgaw/psychic-garbanzo
/5/week1/airline_crews/airline_crews.py
UTF-8
5,727
3.3125
3
[]
no_license
# python3 import collections class Edge: def __init__(self, u, v, capacity): self.u = u self.v = v self.capacity = capacity self.flow = 0 def __repr__(self): return '<u: {0} v: {1} cap: {2} flow: {3}>'.format(self.u, self.v, self.capacity, self.flow) # This class imple...
true
9d54f7ac06ed620f9e8d26138de3d1dcd878cad7
Python
Derek-Cartwright-Jr/Data-Structures-And-Algorithms
/Linear_Structures/linkedlist.py
UTF-8
4,714
4.25
4
[]
no_license
class Node: def __init__(self, data): self.data = data self.next = None def __repr__(self): return str(self.data) def get_data(self): return self.data def get_next(self): return self.next def set_next(self, node): self.next = node class LinkedList: def __init__(self, iterator=[]): self.head = ...
true
70621613684910fc55dfc56083f4df501a4d21fc
Python
siva6160/num
/becomde2-5.py
UTF-8
328
3.625
4
[]
no_license
import math def isarmstrong(num): r=0 sum=0 temp=num for i in range(1,num+1): r=num%10 sum+=math.pow(r,3) num=num//10 if(temp==sum): print("Arm Strong Number") else: print("Not Arm Strong Number") num=int(input("")) isarmstrong(num) ...
true
d0d6ea080b212df22c07b4e2ac3cf67354a4db98
Python
icicleling/learnPython
/10io/jsonStudent.py
UTF-8
372
3.21875
3
[]
no_license
import json class Student(object): def __init__(self, name, age, score): self.name = name self.age = age self.score = score def dict2student(d): return Student(d['name'],d['age'],d['score']) s =Student('Bob',20,88) s_dumps=json.dumps(s,default=lambda obj:obj.__dict__) print(s_dumps) ...
true
ba5daf41503020944a27f117f70fc4088c5678d3
Python
Zhenye-Na/leetcode
/python/186.reverse-words-in-a-string-ii.py
UTF-8
1,928
4.375
4
[ "MIT" ]
permissive
# 186. Reverse Words in a String II # Description # Given an input character array, reverse the array word by word. # A word is defined as a sequence of non-space characters. # The input character array does not contain leading or trailing spaces # and the words are always separated by a single space. # Example # ...
true
4e1e1c1ecdf4c3fd5c083da8094a11fa2fed337c
Python
gkahn13/gcg-old
/src/gcg/policies/tf/bnn/probabilistic_backprop/network_layer.py
UTF-8
3,106
3
3
[]
no_license
import math class Network_layer: def __init__(self, m_w_init, v_w_init, non_linear = True): # We create the theano variables for the means and variances self.m_w = theano.shared(value = m_w_init.astype(theano.config.floatX), name='m_w', borrow = True) self.v_w = theano.shared...
true
781d235d7e1bbf606de6cd754461ccb0e55c4251
Python
shoma0987/At_coder_code
/atc176/D_176.py
UTF-8
49
3.1875
3
[]
no_license
a = [4,5,6] for i in range(2): print(a[i])
true
ad7144966587513d0b2b9fdfcf4193d7ccca8701
Python
bdwilliamson/spvim_supplementary
/code/sims/run_shapley_sim_once.py
UTF-8
9,762
2.859375
3
[ "MIT" ]
permissive
# run through simulation one time def do_one(n_train, n_test, p, m, measure_type, binary, gamma, cor, V, conditional_mean = "nonlinear", estimator_type = "tree"): """ Run the simulation one time for a given set of parameters @param n: sample size @param p: dimension @param m: number of subsets to...
true
47d21df3bce23c51524b9bf9d0ee55003a285236
Python
seanchoi/algorithms
/CyclicRotation/cyclicRotation.py
UTF-8
1,030
4.53125
5
[]
no_license
""" An array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first place. For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7] (elements are shifted right by one index and 6 is mov...
true
3ef6273e4a25c6f76b68f90ac77abc6ef7e477f9
Python
psydok/booka_db
/src/connection.py
UTF-8
259
2.578125
3
[]
no_license
import sqlite3 class _Connection(object): """Подключение БД""" def __init__(self): self.conn = sqlite3.connect("test_booka01.db") # или :memory: чтобы сохранить в RAM self.cursor = self.conn.cursor()
true
1577c3d178a8cce10e2aa29375df719829f1f61b
Python
mahlikag/Capstone_Code_Final
/Cleaning/cluster.py
UTF-8
2,608
3.34375
3
[]
no_license
"""importing the required packages""" import pandas as pd from pylab import rcParams import seaborn as sb import matplotlib.pyplot as plt import numpy as np import math as m import sklearn from sklearn.cluster import DBSCAN from collections import Counter """this function creates the clusters from DBSCAN""" def creat...
true
5fb8328d54b6eb0c2e619065871a2e2289df7b97
Python
KomissarovSemyon/Course_work_database
/schema/init.py
UTF-8
1,184
2.78125
3
[]
no_license
import json from collections import defaultdict import psycopg2 import sys def load_country_tuples(): with open("countries_en.json") as f: en = json.load(f) with open("countries_ru.json") as f: ru = json.load(f) uni = defaultdict(lambda: [None]*2) for c in ru: uni[c[0]][0] = ...
true
a86ddcaa52e65a24f81a68b6b681fc66285c6bb8
Python
google/pytype
/pytype/pytd/transforms_test.py
UTF-8
2,562
2.78125
3
[ "Apache-2.0", "MIT" ]
permissive
"""Tests for transforms.py.""" import textwrap from pytype.pytd import transforms from pytype.pytd.parse import parser_test_base import unittest class TestTransforms(parser_test_base.ParserTest): """Tests the code in transforms.py.""" def test_remove_mutable_list(self): # Simple test for RemoveMutableParam...
true
9dcfbd51b17744c4f6cd51b8ea93a34b6aa0ac57
Python
mkaminskas/beyond_accuracy
/frameworkMetrics/diversity.py
UTF-8
4,345
3.21875
3
[]
no_license
''' Created on 12 Feb 2015 @author: mkaminskas ''' from utils import config def getListDiversity(training_data, item_list, method): ''' list diversity, computed as defined by [McClave & Smyth, 2001]: diversity(R) = SUM{i in R} SUM{j in R\i} {dist(v_i, v_j)} / |R| * |R|-1 where dist(v_i, v_j) is the dist...
true
15823d24a08e1628dc36918157990db00f971724
Python
DanielSammon576/DCU-College-Work
/CA117/readnum_022.py
UTF-8
373
3.40625
3
[]
no_license
#!/usr/bin/env python import sys def main(): a = [] for line in sys.stdin: a.append(line.strip()) i = 0 while i < len(a): if a[i].isdigit(): print("Thank you for {:}".format(a[i])) i = len(a) else: print("{:} is not a number".format(a[i])) ...
true
db1e6367c46ca9121ceec1b9cb4db28f2fb32438
Python
profhall/py-slack-bot
/storefinderbot.py
UTF-8
4,169
2.515625
3
[]
no_license
from slackclient import SlackClient import os, time, json from play import markets from THD_MD.getMarkets import listMarkets """ Psuedocode #if event is a message, then... #if message contains botid #if message contains 'directions' #ask to what store #and the starting destination ...
true
5bf54e3fe8b74c080b6df2e42c02b255bc3b1d6d
Python
blejdfist/NeuBot
/tests/TestArguments.py
UTF-8
2,923
3.28125
3
[]
no_license
import unittest from models.arguments import Arguments class TestArguments(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def testArgumentLengths(self): self.assertEqual(len(Arguments("a b c")), 3) self.assertEqual(len(Arguments(" a b c")), 3) ...
true
55ef9f74f6115ef191c428fa36ed6a864f2ec405
Python
Hunt66/holbertonschool-higher_level_programming
/0x01-python-if_else_loops_functions/9-print_last_digit.py~
UTF-8
119
3.125
3
[]
no_license
#!/ust/bin/python3 def print_last_digit(number): number = number % 10 print(number, end='') return number
true
30ac3704777b1e156217f0311b992e54d90e5191
Python
tahsinalamin/leetcode_problems
/leetcode-my-solutions/58_length_of_last_word.py
UTF-8
333
3.875
4
[]
no_license
""" Author: Sikder Tahsin Al-Amin Problem: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. Input: "Hello World" Output: 5 """ def lengthofLastWord(s): substr = s.split() if len(substr)==0: return 0 else: ...
true
16a6a27beeceb42ab7ce22262083e4e87807778f
Python
ilya-il/projecteuler.net
/p005.py
UTF-8
535
3.265625
3
[]
no_license
#!/usr/bin/python3 # coding: utf-8 # IL 30.10.2017 """ ProjectEuler Problem 5 """ __author__ = 'ilya_il' import time def get_number2(init): # factors, skip 1 and 2 because of step 10 (number is even in any case) f = [x for x in range(3, init + 1)] for i in range(10, 1000000000, 10): for j ...
true
48f0ed85bda0a4668197aa2be60bafbb98f9114c
Python
amulya444/CBIR-CNN-SVM
/packages/Model/BaseModel.py
UTF-8
614
2.671875
3
[]
no_license
class BaseModel: def __init__(self, kernels = {}, optimizer = 'adadelta', loss = 'categorical_crossentropy'): self.optimizer = optimizer self.loss = loss self.model = None self.kernels = kernels self.initModel() def initModel(self): raise NotImplementedError ...
true
24ec8ae24f07be54f2990722b4eb9769a1b354ba
Python
preetanshu2508/Python-Django
/practicepython +tkinter/python/fhandlind2.py
UTF-8
517
3.046875
3
[]
no_license
''''x=input("enter file name") f=open(x,"w+") st=int(input("Enter No of students")) for i in range(1,st+1): rn=input("enter your roll no") sn=input("Enter student name") m=input("Enter Your marks") f.write((str)(st)+'\n') f.write('Roll no'+rn+'\n') f.write('Name'+sn+'\n') f.write('...
true
8ffec07a2469e54e54ac82f7bd7b93eca2332a00
Python
Panamera-Turbo/MyPython
/loop/while.py
UTF-8
754
4.09375
4
[]
no_license
''' while循环 ''' number = 0 while number < 5: print(number+10) number += 1 # 让用户选择何时退出 print('\n--------------------------------\n第一次实验') a = '\n输入的内容会被重复' a += '\nwq保存退出:' message = '' while message != 'wq': message = input(a) if message != 'wq': print(message) print('-------...
true
1680d3efcc43460259b5b3876429a843f3dd79c5
Python
tonymtran36/Python-Basics
/Homework/Assignment3.py
UTF-8
2,591
3.828125
4
[]
no_license
#Question 7 a --------------------------------------------------------------------------------------------------- def findDiv7(): for i in range(1500,2701): if (i%7==0 and i%5==0): print(i, end=", ") print() findDiv7() #Question 7 b ------------------------------------------------...
true
7f82b9c36058f01fbdf1613167fefe424872b903
Python
shubhampachori12110095/Chatbot-Keras-TransferLearning
/Process_WhatsAppData_2.py
UTF-8
6,067
2.6875
3
[]
no_license
############################################################################################################################################## # AUTHOR: KUNAL PALIWAL # EMAIL ID: kupaliwa@syr.edu # COURSE: ARTIFICAL NEURAL NETWORKS # This file is responsible for processing our dataset and building padded inputs and ou...
true
9c6fc9e13e64190eba7cf82ed1edcc48434eb4b5
Python
StevenMMortimer/one-r-package-a-day
/script.py
UTF-8
3,911
2.75
3
[]
no_license
# script.py from os import environ from os.path import join, dirname from dotenv import load_dotenv import re import pandas from TwitterAPI import TwitterAPI, TwitterPager # create .env file path try: # this will fail if running interactively which will source # the script from current directory dotenv_pa...
true