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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a0a16341b5fde56b70b2ef2340bf37bb74a44dc7 | Python | nnizh13/WikiSource | /WikiSource/spiders/text_urls.py | UTF-8 | 2,095 | 2.859375 | 3 | [] | no_license | import scrapy
from WikiSource.items import WorkUrl
class TextUrls(scrapy.Spider):
name = 'get_text_urls'
start_urls = ['https://en.wikisource.org/wiki/Category:Works_by_era',
'https://en.wikisource.org/wiki/Category:Works_by_type',
'https://en.wikisource.org/wiki/Category:W... | true |
b7e8124d75ec7aafd020bf365c08a0a901203aac | Python | pranayyelugam/Online-Book-Store | /tests/cacheMiss_2.py | UTF-8 | 1,194 | 2.546875 | 3 | [] | no_license | import time, os, sys
import requests
import datetime
scriptDir = os.path.dirname(__file__)
def testForCacheMiss():
log = os.path.join(scriptDir, './outputs/averageTimeCacheMiss.txt')
averageTimeCacheOutput = os.path.join(scriptDir, './outputs/averageTimeCacheMissOutput.txt')
local = "http://0.0.0.0:8081... | true |
a3629f9b8b5d40744ebba698a56de0894f7945d4 | Python | avaltechinova/smartusAiModeling | /modeling_config.py | UTF-8 | 4,673 | 2.609375 | 3 | [] | no_license | import numpy as np
class CrossValidationConfig:
def __init__(self, cv_type='k_fold', nr_splits=5, shuffle=False, batch_size=32):
self.__cv_type = cv_type
self.__nr_splits = nr_splits
self.__shuffle = shuffle
self.__batch_size = batch_size
@property
def cross_validation_typ... | true |
5b42bcb078355d2448975b9309709f27143ee1c4 | Python | RecluseXU/learning_spider | /example/0_Basic_usage_of_the_library/python/7_统计文件行数.py | UTF-8 | 1,501 | 3.0625 | 3 | [
"MIT"
] | permissive | # -*- encoding: utf-8 -*-
'''
@Time : 2023-05-19
@Author : EvilRecluse
@Contact : https://github.com/RecluseXU
@Desc : 计算大文件行数
4核8G python3.6 测算速度 单位: 秒
计算方法 100M 500M 1G 10G
readline 0.13 0.85 1.58 13.53
buffer_count 0.13 0.62 1.18 10.21
buffer_co... | true |
08f33ad0fd8e94e2552fbb5f050bd1eed8dda856 | Python | bangbao/wsweb | /lib/db/mysqldb.py | UTF-8 | 2,092 | 2.625 | 3 | [] | no_license | # coding: utf-8
import datetime
import hashlib
import MySQLdb
md5 = lambda x: hashlib.md5(x).hexdigest()
escape_string = MySQLdb._mysql.escape_string
def force_str(text, encoding="utf-8", errors='strict'):
t_type = type(text)
if t_type == str:
return text
elif t_type == unicode:
return t... | true |
25c79ef0a8907530e4802a6f53731f4cb49742f9 | Python | QMIND-Team/Voting-Optimization | /Reducing_STD_Model.py | UTF-8 | 6,352 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat, Nov 17, 2018
@author: Caelum Kamps, Sean Kato, Dan, Denis, Ali
"""
import pandas as pd
import getData
#%% Preliminary initializations and imports
data = pd.read_pickle('OurSortedData') # Pickled data
data = data.drop(5219) #This was the row giving us trouble
data = data.... | true |
1a6e78feebca4eccab68432b0def073bf1e5ed1d | Python | NGC-6543/Seattle_Airbnb | /listings.py | UTF-8 | 19,191 | 2.625 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on 20l20-10-22
Authhor: NGC-6543
"""
import pandas as pd
import datetime # convert dates to timespan since 2016-01-04 (scrape date)
import math # check for NaN's
import os
os.getcwd()
# os.chdir('./')
# os.getcwd()
###############################################################... | true |
0dbac94eee0c28d934f6e619f21ee28b5976be12 | Python | saikatsk/PythonJIRA | /createIssue.py | UTF-8 | 643 | 2.78125 | 3 | [] | no_license | # Developed by Koushik - Apr 2020
# Purpose: Create a JIRA issue
from jira import JIRA
import getpass
# login to JIRA using username and password
print("Enter credentials to login to JIRA:")
user = input("Username: ")
pw = getpass.getpass()
jira = JIRA(auth=(user, pw), options={'server': 'https://jira.kfplc.com'})
# ... | true |
73a4b8e30a34fdb14377ed8b60d9d5e48ecdc9ce | Python | Aasthaengg/IBMdataset | /Python_codes/p02918/s874728961.py | UTF-8 | 269 | 2.53125 | 3 | [] | no_license | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
S = input()
score = 0
for i in range(N - 1):
if S[i + 1] == S[i]:
score += 1
score = min(score + 2 * K, N - 1)
print(score) | true |
54f1c1f94d297925a53084dd2e8cf6dc2034fefd | Python | StacyFelix/hw_ORM_Mongo | /ticket.py | UTF-8 | 3,406 | 3.09375 | 3 | [] | no_license | import csv
import re
from pymongo import MongoClient
client = MongoClient()
tickbd = client['tickbd']
def load_tickets(bd, collection='ticket', csv_file='ticket.csv'):
"""
Загрузка данных в коллекцию ticket из CSV-файла
"""
concert_ids_list = load_concerts(tickbd, 'concert', 'concert.csv')
with ... | true |
5e7b39b8a527cc147b9adbf717ebe49782fc7c45 | Python | Weidaoqin/Pythom.work | /ex2-4.py | UTF-8 | 130 | 2.828125 | 3 | [] | no_license | #2.4等边三角形.py
from turtle import *
setup(650,350,200,200)
pendown()
fd(100)
seth(120)
fd(100)
seth(240)
fd(100)
| true |
2d2c0448381719652a6650dce221b98156c22b9f | Python | Lanceolata/code | /algorithms/algorithms-python/leetcode_easy/Question_214_Rotated_Digits.py | UTF-8 | 401 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python
# coding: utf-8
class Solution(object):
def rotatedDigits(self, N):
"""
:type N: int
:rtype: int
"""
s1 = set([1, 8, 0])
s2 = set([1, 2, 5, 8, 6, 9, 0])
def isGood(n):
s = set([int(i) for i in str(n)])
return s.issubs... | true |
cc36729df0d4386c1398668a8a1329e6e10b7651 | Python | Mschnuff/FlaskWebSpiel | /gothonweb/ork.py | UTF-8 | 508 | 2.8125 | 3 | [] | no_license | class Ork(object):
def __init__(self, name):
self.name = name
self.hitpoints = 100
self.hp_inverse = (100 - self.hitpoints)
self.checked = False
self.amleben = True
#self.hp_inverse = (100 - self.hitpoints)
def erleideSchaden(self, schaden):
self.hitpoin... | true |
53325875f6faf57de762a261d9083f7cfa3c3c3b | Python | yousukeayada/TicTacToe-RL | /TicTacToe.py | UTF-8 | 1,454 | 3.09375 | 3 | [] | no_license | from itertools import product
from enum import IntEnum, auto
import numpy as np
from Board import *
class Turn(IntEnum):
FIRST = 0
SECOND = 1
class TicTacToe:
def __init__(self, size=3):
self.size = size
self.num_squares = self.size * self.size
self.board = Board(siz... | true |
7e9f8b41359a98bfb01f3edc1b480e0c8899625a | Python | erfanian/AsciiFree | /engine/game_engine.py | UTF-8 | 4,352 | 2.96875 | 3 | [] | no_license | #! /usr/bin/env python3.0
##########################################################################
## AsciiFree project #####################################################
## An open-source, ASCII-graphics version of SkiFree #####################
## Spring 2013 ######################################################... | true |
c19cd2dcd12853db4cb509f3c8edefd03cb3bfe1 | Python | keszybz/minima | /minima.py | UTF-8 | 438 | 3.40625 | 3 | [] | no_license | def minima(arr):
ans = []
i = 0
for i in range(len(arr) - 1):
if arr[i-1] < arr[i] and arr[i] > arr[i+1]:
ans.append(i)
return ans
def maxima(arr):
ans = []
i = 0
for i in range(len(arr) - 1):
if arr[i-1] > arr[i] and arr[i] < arr[i+1]:
ans.append(... | true |
b34cc53e7deba762869b0875296f58a452b25d74 | Python | austin-niemann/Add | /AddStudents.py | UTF-8 | 3,452 | 2.984375 | 3 | [] | no_license | import pandas as pd
import xlsxwriter as xlsxwriter
import subprocess, sys
filePath = input("Enter File Path")
user = input("enter first.last name")
# import student name csv file
new = filePath[1:-1]
df = pd.read_csv(r"%s" % new, header=None, encoding='UTF-8')
# drop blank lines
df.dropna(axis=0, how=... | true |
e10b13ba4de4379fa9ba313c87205366665504a4 | Python | siddhism/leetcode | /tree/check_full_binary_tree.py | UTF-8 | 988 | 3.859375 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __repr__(self):
return str(self.data)
def inorder(node):
if not node:
return
inorder(node.left)
print node.data
inorder(node.right)
root = Node(1)
root.lef... | true |
ca5d95b55b8aa6f78de69b332c621bceed846d68 | Python | YiseBoge/CompetitiveProgramming | /LeetCode/Sorting/sort_by_distance.py | UTF-8 | 876 | 3.1875 | 3 | [] | no_license | import sys
def sort_by_distance(R: int, C: int, r0: int, c0: int):
collected_items = {}
origin = [r0, c0]
result = []
for i in range(R):
for j in range(C):
k = [i, j]
d = abs(k[0] - origin[0]) + abs(k[1] - origin[1])
if collected_items.get(d) is None:
... | true |
f6cf9f67323e6de795b25423bfa3d87b4909c4b8 | Python | barcern/python-crash-course | /chapter8/c8_16_imports.py | UTF-8 | 1,196 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 25 12:52:52 2020
@author: barbora
"""
# Using a previously used function, store it in a module, and import the
# function using each import option.
# Using c8_14_cars
# Import full module
import c8_16_imports_functions
this_car = c8_16_imports_functions.make_car('renau... | true |
565dc9d8cf838852bf920ec697e15825e5af2f21 | Python | ieee-saocarlos/desafios-cs | /Victor Macedo/Produtos.py | UTF-8 | 488 | 3.234375 | 3 | [] | no_license | L=12
O=12
P=24
S=5
I=6
Leite=int(input("Digite a quantidade de conjutos de Leite:" ))
Ovos=int(input("Digite a quantidade de conjutos de Ovos: "))
Prend=int(input("Digite a quantidade de conjutos de Prendedores: "))
Sabão=int(input("Digite a quantidade de conjutos de Sabão: "))
Ior=int(input("Digite a quantidade de ... | true |
882e3be3601729364193437c89166ecad0b948f0 | Python | luckycontrol/Algorithm_with_python | /BubbleSort.py | UTF-8 | 342 | 3.46875 | 3 | [] | no_license | def bubble(list):
sorted = False
length = len(list) - 1
while not sorted:
sorted = True
for i in range(length):
if list[i] > list[i+1]:
sorted = False
list[i], list[i+1] = list[i+1], list[i]
return list
lst = list(map(int, input().split(... | true |
9310cffcb7cef5dfb6ffd065844aeb24e644057a | Python | rokmokorel/Programiranje_1 | /03_pisanje funkcij/08_napadalne kraljice.py | UTF-8 | 3,311 | 2.875 | 3 | [] | no_license | import random
razpored = ["a4", "c7", "d2"]
stolpci = "abcdefgh"
vrstice = "12345678"
# ********************************* ZA OCENO 6 *********************************
def stolpec_prost(stolpec, razpored):
for i in razpored:
if i[0] == stolpec:
return False
return True
print(stolpec_pr... | true |
8ea441a6644887576ba337a960ebd98c6e0a3706 | Python | PulHome/infosystem | /pylint/tests/regPhoneNumbers/my.py | UTF-8 | 334 | 3.328125 | 3 | [
"MIT"
] | permissive | # С помощью регулярных выражений найдите в строке дважды подряд повторяющиеся слова.
# Удалите эти повторы, распечатайне строку без повторов.
import re
s = input()
print(re.sub(r'\b(\w+)\b(.+)\b(\1)\b', r'\1', s)) | true |
7ed429d4e8a8efe210c44f055b24d1e1fedfe345 | Python | virusrussia/MTS-scrapping | /Regoin.py | UTF-8 | 4,602 | 2.671875 | 3 | [] | no_license | from MTS import *
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by im... | true |
6c7733ce8093dcadd75adfe8739737a40339be0c | Python | rogerhoward/barb | /plugins/whoami/__init__.py | UTF-8 | 378 | 2.71875 | 3 | [] | no_license | import config
# Whoami plugin
def consider(message):
"""Whoami: returns the askers username.
Return: String containing a username, or False.
"""
if config.log: print('whoami considered')
if 'whoami' in message['text']:
if config.log: print('whoami triggered')
return 'you are {}'.f... | true |
6b130fa2b59303805880b6e2cb7a5d3f4a2fefca | Python | thommms/hacker_rank | /algorithms/warmup/python/birthday_cake_candles.py | UTF-8 | 108 | 3.296875 | 3 | [] | no_license | n = int(input())
candles = [int(c) for c in input().strip().split(' ')]
print(candles.count(max(candles)))
| true |
84277dde39dc9b9ba32d48ee811154c9ca1bf363 | Python | kelraf/ifelif | /learn python 3/ifelif.py | UTF-8 | 872 | 4.375 | 4 | [] | no_license | #The program asks the user to input an intager value
#The program evaluates the value provided by the user and grades it accordingly
#The values provided must be between 0 and 100
#caution!!! if you provide other values other than ints the program will provide errors
marks=int(input("Please enter Students marks to Gra... | true |
b5ea14cff8da127898c7f780610c79a11781dfe0 | Python | BarryZM/zoubo | /3_DataAnalysis/0_Feature_engineering/101_My_Learn/99_My_Ensemble/2_Bagging/4_RandomForestRegressor.py | UTF-8 | 810 | 2.9375 | 3 | [] | no_license | from sklearn.datasets import load_boston # 一个标签是连续西变量的数据集
from sklearn.model_selection import cross_val_score # 导入交叉验证模块
from sklearn.ensemble import RandomForestRegressor # 导入随机森林回归系
boston = load_boston()
regressor = RandomForestRegressor(n_estimators=100, random_state=0, oob_score=True) # 实例化
regressor.fit(bost... | true |
b50bf3c45edd0235b3729a1205d5cb5d7de8aa47 | Python | Aasthaengg/IBMdataset | /Python_codes/p03068/s848020132.py | UTF-8 | 139 | 3.4375 | 3 | [] | no_license | input()
S = input()
K = int(input())
c = S[K -1]
for i in S:
if i != c:
print('*', end='')
else:
print(i, end='')
| true |
046bd214c938e63595f3d9fdeed82ecf1327b6b7 | Python | ayushtiwari7112001/Rolling-_dice | /Dice_Roll_Simulator.py | UTF-8 | 640 | 4.0625 | 4 | [] | no_license | #importing modual
import random
#range of the values of dice
min_val = 1
max_val = 6
#to loop the rolling through user input
roll_again = "yes"
#loop
while roll_again == "yes" or roll_again == "y":
print("Roll the dices...")
print("** The values are **")
#generating and printing 1st random intege... | true |
5aa1c6d8f54a45977e9b897f2077c10e402b0459 | Python | dengl11/Leetcode | /problems/longest_word_in_dictionary_through_deleting/solution.py | UTF-8 | 460 | 2.84375 | 3 | [] | no_license | class Solution:
def findLongestWord(self, s: str, d: List[str]) -> str:
d.sort(key = lambda s: (-len(s), s))
def sub(w):
i = 0
for c in w:
while i < len(s) and s[i]!=c:
i += 1
if i >= len(s):
return Fals... | true |
25fcdd3fe5461ca410b97d24a6f73769f2e141e0 | Python | TREMA-UNH/lstm-car | /src/data_preproc_qa.py | UTF-8 | 3,329 | 2.71875 | 3 | [] | no_license | import itertools
from utils import *
import csv
prefixlen = 40 # prefixlen must be >= maxlen!
def get_training_seqs(f: typing.io.BinaryIO, lines: int) -> Iterator[Tuple[List[Word], List[Word]]]:
'Returns list of sequences of words for training'
if lines<0:
return read_train_query_paras(f)
else:
... | true |
b0435ba38c12d26d345c491a7d22792a58c142e1 | Python | niuyaning/PythonProctice | /06/19/test2.py | UTF-8 | 135 | 3.09375 | 3 | [] | no_license | #位置传参
#注:参数顺序必须一致
def hobby(type,name):
print(f"my favorite {type} is {name}")
hobby("旅行","北京") | true |
8fcd777e805b18282876e064a55795041f7742ab | Python | davereid98133/acq4 | /acq4/devices/LightSource/LightSource.py | UTF-8 | 2,138 | 2.546875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from acq4.devices.Device import *
from PyQt4 import QtCore, QtGui
import acq4.util.Mutex as Mutex
class LightSource(Device):
"""Simple device which reports information of current illumination source."""
sigLightChanged = QtCore.Signal(object) # to be used upstream
def __init_... | true |
7f5919a77b44f46aabf086df3d3f448769651886 | Python | coloneljuhziz/tceh_homeworks | /blog/blog.py | UTF-8 | 2,663 | 2.578125 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, url_for, abort
# from time import strftime
import json, datetime, re
app = Flask(__name__)
class Post():
def __init__(self, name, header, text, time):
self.name = name
self.header = header
self.text = text
self.id = None
... | true |
c771dacb5e82a6723ff5acc8266cc3b9e4ae5f28 | Python | BambooFlower/Math-Scripts | /Code/Monte Carlo Simulations/inverse_transform_sampling.py | UTF-8 | 677 | 3.015625 | 3 | [
"MIT"
] | permissive | from scipy.stats import expon
import matplotlib.pyplot as plt
import numpy as np
def Inverse_transform_sampling_Exponential(M,lambda_):
expon_x = []
for i in range(M):
u = np.random.uniform(0, 1)
x = expon.ppf(u, lambda_) - 1
expon_x.append(x)
return(np.array(expon_x))
exponentia... | true |
b4610112170767ea891f390c0708495563cbcdc3 | Python | kajibutest/gascrape | /sample_last_names.py | UTF-8 | 1,612 | 3 | 3 | [] | no_license | #!/usr/bin/python
import argparse
import json
import os
import random
# Logic:
# 1) if word count < 2 => not cn
# 2) if word count = 2 => check against list
# 3) if word count > 2 => check last and second last + last against list
def classify(name, names):
parts = name.split()
if len(parts) <= 1:
return False... | true |
867008153fae7fb87ef449de504f9b8d0277fece | Python | aepuripraveenkumar/Data-structures-and-algorithms-in-python-by-michael-goodrich | /R-1.3.py | UTF-8 | 206 | 3.546875 | 4 | [] | no_license | '''Python program to find minmax using built-in functions'''
def minmax(*data):
return (*data,*data) if len(data)==1 else (min(data),max(data))
if __name__=='__main__':
print(minmax(4,100,10,1)) | true |
f0b78b0ff2c5a6f11514df4b7bb66c87db2b9009 | Python | yasin-esfandiari/InvertedPendulumRobotBalancing | /utils.py | UTF-8 | 105 | 2.90625 | 3 | [] | no_license | def find_slope(up_rect, down_rect):
return (up_rect[1] - down_rect[1])/(up_rect[0] - down_rect[0])
| true |
d18c543f2378b0c2eb66a21f91bf417f3042ba8a | Python | xiangcao/Leetcode | /Python_leetcode/222_count_complete_tree_nodes.py | UTF-8 | 2,729 | 3.375 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def countNodes(self, root):
"""
:type root: TreeNode
:rtype: int
"""
left = right... | true |
bff5ce19f00f0e7ee69d475423d9b74444e81281 | Python | lydiaq233/MovieTheaterSeating | /launch.py | UTF-8 | 3,661 | 3.234375 | 3 | [] | no_license | import sys
from helper import *
class Seating:
def __init__(self,request,sum):
self.smallest_available_row=0
# self.smallest_available_size=20
self.seat = [ [0]*20 for i in range(10)]
self.request=request
self.total_n=sum
self.result=dict()
def print_result(self... | true |
e601e058040d9468a5c105bbbaae10cc1a147b16 | Python | oykuykaya/atom_project | /main.py | UTF-8 | 88 | 3.734375 | 4 | [] | no_license | x = 5
if x < 10:
print ('Smaller')
if x > 20:
print ('Bigger')
print ('Finis')
| true |
7512854f6755ed841308f7008d8b682c9d89b8bf | Python | GeraldNDA/Advent-Of-Code-2019 | /day20/day20_1.py | UTF-8 | 7,065 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
# Imports
from mapping import Directions, Point
from aoc import AdventOfCode
# Input Parse
puzzle = AdventOfCode(year=2019, day=20)
puzzle_input = puzzle.get_input(raw=True)
# puzzle_input = [
# " A ",
# " A ",
# " ###############... | true |
c2d3a908f2317dd85339147dc6342f96d696b33e | Python | pranay2063/PY | /Selenium/Element.py | UTF-8 | 348 | 2.953125 | 3 | [] | no_license |
# search any element in a html page
from selenium import webdriver
browser = webdriver.Firefox()
type(browser)
browser.get('https://gabrielecirulli.github.io/2048/')
try:
elem = browser.find_element_by_class_name('game-explanation')
print('found <%s> element with this class name!' %(elem.tag_name))
except:
prin... | true |
b1b47d8f1d1014302cc46196bbaf270902e03469 | Python | amyfranz/Problem-2-fibonacci- | /main.py | UTF-8 | 387 | 3.515625 | 4 | [] | no_license | def fib(n, maxNum):
if n == 1:
return [1]
elif n == 2:
return [1,2]
else:
x = fib(n-1, maxNum)
if sum(x[:-3:-1]) > maxNum:
return x
x.append(sum(x[:-3:-1]))
return x
def getSum(n, maxNum):
fibSeq = fib(n, maxNum)
sum = 0
for i in range(0, len(fibSeq)):
if fibSeq[i] % 2 == 0... | true |
b34ee689ed03bf5c1ea851798d758413dfd91c08 | Python | vishnutejakandalam/python_learning_2020 | /first.py | UTF-8 | 145 | 3.171875 | 3 | [] | no_license |
a = input("Enter the value of a: ")
b = input("Enter the value of nonsense: ")
# input scanf()
c = int(a)+int(b)
print("hello world! ",c)
| true |
251a2dd167b6f4c5f49048eea2a77f962b5d6bf2 | Python | AsiganTheSunk/GerardoElMagias | /core/game/battle/enemy/set_generator.py | UTF-8 | 790 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from random import choice
from core.units.constants.unit_type import UnitType
class EnemySetGenerator:
@staticmethod
def generate_set(group_size, enemy_pool):
# enemy_pool = [EnemyType.BANDIT]
tmp = []
for i in range(group_size... | true |
61adb8d17c51be1c7388b625dc806af8fef4743b | Python | alecone/VNCC_Server_Python | /prova_server.py | UTF-8 | 1,125 | 2.921875 | 3 | [] | no_license | import socket
from threading import Thread
from socketserver import ThreadingMixIn
import os
import json
import sys
import errno
ip = '192.168.0.18'
port = 2018
class ClientThread(Thread):
def __init__(self,ip,port,sock):
Thread.__init__(self)
self.ip = ip
self.port = port
self.soc... | true |
807076049d0cfdfc2d8bc86b4ee2b0135a06a36e | Python | sauravp/snippets | /python/plus_one.py | UTF-8 | 703 | 3.375 | 3 | [] | no_license | # https://www.interviewbit.com/problems/add-one-to-number
class Solution:
# @param A : list of integers
# @return a list of integers
def plusOne(self, A):
carry = False
stop = False
i = len(A) - 1
while not stop and i >= 0:
if A[i] == 9:
A[i] = 0
... | true |
b0fc6db5cd7b9c6283c6f66aaf1485adac0bf3a2 | Python | gonzaponte/Python | /funny/turtle.py | UTF-8 | 2,155 | 3.15625 | 3 | [] | no_license | from check import *
from math import *
import swampy.TurtleWorld as tw
def maketurtle():
''' This is a function to establish the turtle and its properties.'''
w = tw.TurtleWorld()
t = tw.Turtle()
w.minsize(1000,1000)
t.set_color('orange')
t.set_pen_color('purple')
t.delay= 0.00001
... | true |
9c3d9dbb6b1467834108668de8547bd69e6f823f | Python | xwmtp/reverse-bot-adventure | /Bot/Logger.py | UTF-8 | 1,045 | 2.65625 | 3 | [] | no_license | from Bot.Config import Configs
import logging
import os
def initalize_logger():
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.handlers.clear()
formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s: %(message)s')
if not os.path.exists('logs'):
os.mkdir('log... | true |
d007ddffaa695beb846b05a4a6cfe1a5ef12c18b | Python | CPFrog/AI_innovation_Lecture | /Assignments/02_Jupyter.py | UTF-8 | 6,697 | 4.28125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ### 문제 1 - input, float()
# * '나' 는 통계학과 재학중이다.
# * 학점은 140학점을 이수해야 하며, 평점은 2.5이상이 되어야 졸업이 가능하다.
# * if문과 A and B 연산자를 이용하여 졸업이 가능한지, 졸업이 안되는지 확인해 보자.
# * 학점과 평점을 입력받는다.
# * 140이상, 2.5이상 졸업
# * 그외 조건 졸업이 힙듭니다.
# * 학점과 평점은 정수가 아니므로 float( input() )의 형태로 입력받아야 한다.
# In... | true |
7dc74d390921e0f7fba67479da4e9341ccfe2821 | Python | WalterKahn4/Python | /Les7/Lesnotes.py | UTF-8 | 838 | 3.65625 | 4 | [] | no_license | i = 7
while i <= 37:
i += 7
def hello():
'''a greeting service; it repeatedly requests the name of the user and then greets the user'''
while True:
name = input('What is your name?')
print('hello {}'.format(name))
def cities2():
lst = []
while True:
city = input('Enter cit... | true |
5c94844229fb13119f3f606cbaa2169cf03f2cbe | Python | Frendyuyu/Python | /Mate.py | UTF-8 | 1,954 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
class Materials(object):
"""
Material Class
Class attribute:
mate_code # 编码 Material code
mate_type # 类型 Material type
mate_Quantity # 数量 Material Quantity
Class method
Warehousing # 入库 Warehousing (Class method)
Shipments # 出货 Shipments (Class me... | true |
66f8c3af79661da45c33d0fe5b97f3133d276928 | Python | x31eq/lumatone_utils | /apply_scheme.py | UTF-8 | 2,358 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Apply a color scheme to a Lumatone mapping file
"""
import argparse, sys
N_BOARDS = 5
KEYS_PER_BOARD = 56
parser = argparse.ArgumentParser(
description='Apply a color scheme to a Lumatone .ltn mapping')
parser.add_argument('-t', '--tonic', type=int, nargs='?', default=0,
... | true |
7b784f260f46c5b3ca9fbde0f27ad4bd927d6fb8 | Python | abhikushwaha/Hacktoberfest2019 | /Python/nth_fibonacci.py | UTF-8 | 297 | 4.40625 | 4 | [
"MIT"
] | permissive | #Python Program to calculate the nth Fibonacci Number
from math import sqrt
def fibonacci(n):
return int(1/sqrt(5)*(((1+sqrt(5))/2)**n - ((1-sqrt(5))/2)**n))
your_number=int(input("Enter the value so that we can calculate its corresponding Fibonacci Number:"))
print(fibonacci(your_number))
| true |
e994adcaa456fb9fe2687e39b5c8d691b221502d | Python | HaberkornJonas/Travel-Order-Resolver_Web_T-AIA-901 | /backend/infrastructure/LanguageProcessing.py | UTF-8 | 16,126 | 2.84375 | 3 | [] | no_license | # Imports
import spacy
from enum import Enum
from spacy.symbols import PROPN, NOUN, CCONJ, ADP, VERB
import numpy as np
class RelationDirection(Enum):
NONE = 1
START = 2
DEST = 3
class RelationStrength(Enum):
NONE = 1
WEAK = 2
STRONG = 3
class LanguageProcessing:
class WordSense:
... | true |
47ae0acd069fbc2fe67f091490d697ad32f70356 | Python | ZDawang/leetcode | /462_Minimum_Moves_to_Equal_Array_Elements_II.py | UTF-8 | 3,921 | 3.796875 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#author : zhangdawang
#data: 2018-1
#difficulty degree:
#problem: 462_Minimum_Moves_to_Equal_Array_Elements_II.py
#time_complecity:
#space_complecity:
#beats:
import heapq
class Solution(object):
#首先我们需要找到那个最终相等的数。
#考虑1个数的情况,肯定是它自身。
#考虑两个数的情况,若两个数为a与b,且a<b,则分析可... | true |
a6502639bb77987d2a9d68aa40764d6a16a8b4aa | Python | AshBringer47/kpi_labs | /Lab 9/Lab 9.py | UTF-8 | 81 | 3.484375 | 3 | [
"Apache-2.0"
] | permissive | array = input("Enter the string here: ").split()
array.sort(key=len)
print(array) | true |
d4fa1be17098909fb72be30e436d66e6712ff0b1 | Python | SafonovMikhail/python_000577 | /001113StepikPyGEK/StepikPyGEK001113сh03p01st07C01_20200408.py | UTF-8 | 65 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | x_1 = float(input())
x_2 = float(input())
print(abs(x_1 - x_2))
| true |
5d27f539c00628d37fd12dcf2d24d9a31caa7724 | Python | monaghrp/600ocwHW2 | /ps2_hangman.py | UTF-8 | 3,096 | 4.25 | 4 | [] | no_license | # 6.00 Problem Set 3
#
# Hangman
#
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
import random
import string
WORDLIST_FILENAME = "words.txt"
def load_words():
"""
Returns a list of valid words. Words are strings of lowercase letters.
Dependin... | true |
deb45e83b718d14f6773827c80a4ad9f242fcc23 | Python | juliaguida/learning_python | /week2/sum_multiply.py | UTF-8 | 307 | 4.28125 | 4 | [] | no_license | # Write a program that takes two inputs from the user and display the sum and multiplication result of the two numbers.
numb_one = int(input(' Please enter a number: '))
numb_two = int(input(' Please enter another number: '))
total = numb_one + numb_two
print(total)
mult = numb_one * numb_two
print(mult)
| true |
be72091129be8d7022c43f8e3aa4ffb878c53bf1 | Python | yuyeh1212/University | /python/34.py | UTF-8 | 120 | 3.84375 | 4 | [] | no_license | # 輸入數字相加
str = input("請輸入數字:")
num_list = [int(num) for num in str.split()]
print(sum(num_list))
| true |
d821400aa14f7310ffdff67850ff2ce60f283aba | Python | PanosRCng/just_war | /justwar/data/Room.py | UTF-8 | 810 | 3.015625 | 3 | [] | no_license | import pygame
from justwar.data.Config import Config
from justwar.data.GameElement import GameElement
from justwar.data.Background import Background
from justwar.data.Maze import Maze
from justwar.data.Gate import Gate
from justwar.data.Stone import Stone
gates = {}
stoneList = []
class Room(GameElement):
def __i... | true |
8d6d9167feb45b84b0502b76d4838f917897c15b | Python | kgashok/GE_8151-unit-programs | /unit1/minList.py | UTF-8 | 1,019 | 4.0625 | 4 | [] | no_license |
# find minimum of two numbers
# a and b are parameters''
def find_min(a, b):
if a < b:
return a
return b
print("Enter two values :")
a = int(input())
b = int(input())
print("Minimum number is ", find_min(a, b))
# find minimum of three numbers
# a, b and c are parameters
def min... | true |
4ffcfc6231d712a5e9f698046fb246dbf4ae628b | Python | Ketupat-Development-Studios/lumos-api | /models/triggers/trigger.py | UTF-8 | 953 | 2.734375 | 3 | [] | no_license | from api.lumos_exception import LumosException
class Trigger:
CLOCK = 'clock'
WEATHER = 'weather'
TEMPERATURE = 'temperature'
def __init__(self, trigger_data):
self.id = trigger_data.get('id')
self.type = trigger_data.get('type')
self.data = trigger_data.get('data')
def crea... | true |
a68cc63050607bf817a285c46893db35732af736 | Python | Waqar-107/Codeforces | /B-set/108B. Datatypes.py | UTF-8 | 230 | 3.28125 | 3 | [] | no_license | # from dust i have come, dust i will be
n = int(input())
a = list(map(int, input().split()))
a = set(a)
a = sorted(a)
for i in range(len(a) - 1):
if a[i] + a[i] > a[i + 1]:
print('YES')
exit(0)
print('NO')
| true |
62776b9689acea3980582260db6ccbfb3b40b691 | Python | SachinthaHG/VTG | /LandmarksCSV.py | UTF-8 | 699 | 2.953125 | 3 | [] | no_license | import csv
from Connector import Connector
class LandmarksCSV:
def CreateCSV(self):
writer=csv.writer(open("landmark_locations.csv",'a+'))
writer.writerow(['Landmark', 'Longitude', 'Latitiude'])
connection = Connector()
connection.makeConnection()
results = connection.retriv... | true |
1f24125dab9f40de8969bf2083ba344610781372 | Python | Jaydeep-07/Python-Automation | /Assignment13/DuplicateFileRemoval.py | UTF-8 | 5,518 | 2.828125 | 3 | [] | no_license | import time
import os
import sys
import hashlib
import datetime
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import schedule
def MailSendWithAttachment(file1,receiver):
fromaddr = "jaydeepvpatil22... | true |
e5f97ddce5664684e6d405ba3078b7033a39e913 | Python | LikeStrangersDo/Gongda_Python_summary | /5.0_object_oritented_programming.py | UTF-8 | 3,698 | 4.40625 | 4 | [
"MIT"
] | permissive | #######################################################################################################################################
# Object-oriented programming (OOP) is a different coding style from functional programming, which you probably started with.
# OOP can be very useful if your when you have a fixed set... | true |
f0b1ecaf12f5e3d7655f16cc727196ef54944f27 | Python | Nimrod-Galor/selfpy | /624.py | UTF-8 | 138 | 3.4375 | 3 | [] | no_license | def extend_list_x(list_x, list_y):
list_x = list_y + list_x
return list_x
x = [4, 5, 6]
y = [1, 2, 3]
print(extend_list_x(x, y)) | true |
2e3e64fac69f8986f7a9bdf9223547b84d0f3ceb | Python | lizenghui1121/DS_algorithms | /leetcode 100/62.不同的路径.py | UTF-8 | 648 | 3.734375 | 4 | [] | no_license | """
一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。
机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。
@Author: Li Zenghui
@Date: 2020-06-30 14:47
"""
def uniquePaths(m, n):
dp = [[0 for i in range(n)] for j in range(m)]
for i in range(m):
dp[i][0] = 1
for j in range(n):
dp[0][j] = 1
fo... | true |
0c21646830756485e28a90e6faca269be24e87d7 | Python | lnestor/ckt_tools | /ckt_tools/helpers/logger.py | UTF-8 | 683 | 3.78125 | 4 | [] | no_license | class Logger:
"""Generic logging class with varying logging levels.
This class has different modes that handle if something should be printed
to the screen. The following modes are:
Detailed Mode: prints human readable messages, otherwise prints csv
Debug Mode: prints useful messaging for debuggin... | true |
c55d93de1b87753634891ae0b5f0ed2f25c145f1 | Python | miikko/Multi-Monitor-Window-Controller | /monitor_manager.py | UTF-8 | 766 | 3.015625 | 3 | [] | no_license | from win32 import win32api
from cursor_tracker import get_cursor_pos
def get_monitors():
return win32api.EnumDisplayMonitors()
def cursor_is_in_monitor(monitor):
cursor_x_pos, cursor_y_pos = get_cursor_pos()
(
monitor_x_start,
monitor_y_start,
monitor_x_end,
monitor_y_end... | true |
98813cd15f49040417a53ecc2c291d0862ec3873 | Python | Mountan327/Mountan327.github.io | /try.py | UTF-8 | 734 | 3.1875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(0,5,20)
x1=np.linspace(0,10,10)
X=[2,1.5,1,0.5]
y1=[]
for i in range(32):
y1.append(X[i%4])
fig=plt.figure('16010140048')
plt.subplot(321)
plt.stem(list(y1))
plt.grid(True)
plt.title('zhouqi')
plt.subplot(322)
y2=2*np.sin(0.5*np.pi*x+2)
plt.title... | true |
517c46ef24b9051e278118f60e1dc389a8853ff6 | Python | Teoroo-CMC/PiNN | /tests/test_bpnn.py | UTF-8 | 4,404 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""unit tests for bpnn implementation"""
import pytest
import numpy as np
import tensorflow as tf
def _manual_sfs():
lambd = 1.0
zeta = 1.0
eta = 0.01
Rc = 12.0
Rs = 0.5
a = np.array([0., 0., 0.])
b = np.array([1., 0., 0.])
c = np.array([1., 1., 0.])
ab = b-... | true |
a2fe3f9371d0002f4db548da1f1d71a9bdbe12e9 | Python | yidaiweiren/Python | /study/day8/全局变量.py | UTF-8 | 178 | 3 | 3 | [] | no_license | #全局变量
#定义一个全局变量
a=100
def test1():
print ("test1_a=%d"%a)
def test2():
print ("test2_a=%d"%a)
test1()
test2()
'''
test1_a=100
test2_a=100
''' | true |
70fdc9e4a5390976b033e832ab5a5e8bfab0f579 | Python | hyschive/gamer-fork | /example/test_problem/Hydro/ClusterMerger/gamer_cluster_ics.py | UTF-8 | 6,054 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | import cluster_generator as cg
import unyt as u
from numpy.random import RandomState
import numpy as np
# Note that cluster_generator does not use unyt units for speed and simplicity,
# so mass units are Msun, length units are kpc, and time units are Myr
# Put the two clusters at a redshift z = 0.1
z = 0.1
# M200 fo... | true |
07c08d4aad0571b64756c86d855fd6e343f5f6aa | Python | vug/coding-moding | /problems/uva/272_TEX_Quotes/main2.py | UTF-8 | 262 | 3.21875 | 3 | [] | no_license | import sys
if __name__ == "__main__":
is_left = True
for char in sys.stdin.read():
if char != '"':
out = char
else:
out = "``" if is_left else "''"
is_left = not is_left
sys.stdout.write(out)
| true |
c7a33419fe9f6ec9b39e4ee311ed4bd0e18cb25a | Python | bus1029/HackerRank | /Interview Preparation Kit/Sorting/Sorting_MergeSort.py | UTF-8 | 1,675 | 3.71875 | 4 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
def mergeSort(a):
if len(a) > 1:
mid = len(a) // 2
lx, rx = a[:mid], a[mid:]
mergeSort(lx)
mergeSort(rx)
li, ri, i = 0, 0, 0
while li < len(lx) and ri < len(rx):
# 왼쪽 Array의 값이 오른쪽... | true |
212e0473e90a327dd8c86c8c2cd1c63705374bfa | Python | piotrkumala-zz/ProjektGrafy | /Shared/Generator.py | UTF-8 | 1,171 | 2.78125 | 3 | [] | no_license | from Shared.CheckSeries import CheckSeries
from Shared.Graph import Graph
def GenerateGraph(a: [], n: int):
if CheckSeries(a[:], n):
a.sort(reverse=True)
b = list(range(0, n))
g = Graph(n, 0.0, 1)
while True:
empty = True
negative = False
for x i... | true |
c89aa066aee7f7e2e70b6ba3b9f4be942d2a3608 | Python | JNWED/git_test | /automation/testcase/iOS/test06_search.py | UTF-8 | 4,955 | 2.59375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import sys
import time
import re
from common.basetestcase import BaseTestCase
sys.path.append('../..')
class SearchTest(BaseTestCase):
@classmethod
def setUpClass(cls):
pass
def setUp(self):
self.tester.logger.info("Device: %s Start case: %s" % (
self.te... | true |
6e64220414843cde7453ff3c5f6fc6ba7d42ea1c | Python | OKoop/NURHandinKoop2 | /Problem6/functions26.py | UTF-8 | 2,097 | 3.578125 | 4 | [] | no_license | import numpy as np
#This function scales a given array to a region where the logarithmic
#regression will work better. It calculates the mean and variance
#and then subtracts the mean from the array and divides by sqrt(sigma).
def Scalefeat(arr):
n = len(arr)
muxo = sum(arr)/n
sigxo = sum((arr-muxo)**2.)/n... | true |
e2d88cbf9ceed9fde6b2996be7e11d8016ee4ea7 | Python | Savanthravi/BMI-CALCULATOR | /bmi2.py | UTF-8 | 741 | 3.46875 | 3 | [] | no_license | name = input("How do you want to enter details si or us: ")
if (name=="si"):
Height=float(input("enter your Height in m: "))
Weight=float(input("enter your Weight in kg: "))
BMI=Weight/(Height*Height)
print(BMI)
else:
Height=float(input("enter your Height in inches: "))
Weight=float(input("enter your Weig... | true |
4bfcbef91b238bd15be7438bec2a864e9362244c | Python | slimpotatoes/FEM_InAsP_strain | /generate_elastic_stiffness_tensor.py | UTF-8 | 1,782 | 3.265625 | 3 | [
"BSD-3-Clause"
] | permissive | # Code to generate elastic stiffness tensor (Cijkl) adapted for FEniCS
# Sigma_ij = C_ijkl * epsilon_kl (4th order rank tensor in 3D space)
import numpy as np
class Generator(object):
def __init__(self):
self.symmetry = None
self.stiff_tensor = np.zeros((3, 3, 3, 3))
self.cijkl_list = []... | true |
0d5f68dd11b561f9e1d3035a2b5fd3493d0359e7 | Python | nickmcadden/Kaggle | /NCAA/2016-17/code/dixoncoles.py | UTF-8 | 5,442 | 2.546875 | 3 | [] | no_license | import sys
import pandas as pd
import numpy as np
import time
import data_dixoncoles as data
import argparse
from sklearn.metrics import log_loss
from scipy.stats import norm
from scipy.special import factorial
from scipy.optimize import minimize
from scipy.stats import skellam
parser = argparse.ArgumentParser(descrip... | true |
f4538e7edefa2203f5f9193e4109d18d5fa9bbac | Python | taliaa10/DigitalCrafts | /Assignments/6-25/test.py | UTF-8 | 293 | 4.03125 | 4 | [] | no_license | total = input("What is your total? $")
tip_pct = input("What percentage would you like to tip? ")
def tip_calc(total, tip_pct):
total_amt = float(total) * float(tip_pct)/100.0
return total_amt
total_amt = tip_calc(total, tip_pct)
print(f'The amount you should tip is ${total_amt:,.2f}') | true |
305c1d97c369eab96ad67877b0fc2b71a462358d | Python | Iagoakiosaito/IA-ChatBot-UFMS | /ChatBot/telegram_bot.py | UTF-8 | 2,600 | 2.609375 | 3 | [] | no_license | from token import set_token
from dicts import getDict_ent, getDict_price
from configs_chatbot import main_function
import logging
from telegram import Update, ForceReply
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext
global comanda
comanda = []
# Log
loggin... | true |
85d962d972848a0de4fe6e4d2c529df6076a3a03 | Python | akotek/data_final_project | /main.py | UTF-8 | 4,674 | 2.75 | 3 | [] | no_license | from data_parsing.similarity import *
import data_parsing.clustering as clustering
import data_parsing.visualization as visualizer
import matplotlib.pyplot as plt
from data_parsing.clustering import determine_num_of_clusters
from predictor.predictor import make_predictions
NUM_OF_CLUSTERS = 4
# Similarity:
# ------... | true |
a62efcd438da500c37657f34872bc7490d540f54 | Python | burak-karakus/pygta5 | /pygta5-4.py | UTF-8 | 990 | 2.609375 | 3 | [] | no_license | import numpy as np
from PIL import ImageGrab
import cv2
import time
from directkeys_mac import KeyPress,KeyDown,KeyUp
def roi(img, vertices):
mask = np.zeros_like(img)
cv2.fillPoly(mask, vertices, 255)
masked = cv2.bitwise_and(img, mask)
return masked
def process_img(org_img):
p_img = cv2.cvtColor(np.float32(or... | true |
3c27cde857082c692b55641d7995cb1c7306be97 | Python | 0x6b7966/mytools | /evaluate.py | UTF-8 | 516 | 3.296875 | 3 | [] | no_license | import pdb
choose=input("buy or sell? default [1]\n1.buy\n2.sell\n:>")
if choose=='2':
sell=float(input("please input your sell price:\n"))
high=float(input("please input high price:\n"))
low=float(input("please input low price:\n"))
score=(sell-low)/(high-low)*100
else:
buy=float(input("please inpu... | true |
ffdc08a6ca565f6acc96c188c86261065f95c1f0 | Python | yoophi/sample-posts-api | /tests/core/domain/test_comment.py | UTF-8 | 550 | 2.78125 | 3 | [] | no_license | from app.core.domain.comment import Comment
def test_comment_model_init():
id_ = 1
comment = Comment(id_, body="body text")
assert comment.id == id_
assert comment.body == "body text"
def test_comment_model_from_dict():
comment = Comment.from_dict({"id": 1, "body": "body text"})
assert comm... | true |
f40cd8939626e63bd9e5ab432812570a8e46f4d1 | Python | psavine42/finaccview | /src/discrete/automota.py | UTF-8 | 1,975 | 3.03125 | 3 | [] | no_license | import numpy as np
from copy import deepcopy
class Automaton(object):
_MOVES = []
def __init__(self, pos, moves=None):
self._pos = pos
self._matrix = None
# self._step_every = step_every
self._moves = moves if moves else self._MOVES
@property
def pos(self):
re... | true |
e039c9f711b61418c918ee93281b476c1d0ab95c | Python | ino-shan/catwellbeing | /users/tests/test_models.py | UTF-8 | 921 | 2.5625 | 3 | [] | no_license | from django.contrib.auth.models import User
from django.test import TestCase
# python manage.py test users/tests
class UserTest(TestCase):
def setUp(self):
the_user = User.objects.create_user(username="inoshan", email="inoshan@yahoo.com", password="BA3bfuf3S", first_name="Inoshan", last_name="Inoshan")
def tearDow... | true |
5df95695b9b9e200322abefe7fd73e3060026ba2 | Python | batzzinga/Curso-Python | /Ejemplo12.py | UTF-8 | 294 | 3.5 | 4 | [
"MIT"
] | permissive | #! /usr/bin/python
# -*- coding iso-8859-15
from random import *
def adivina(n):
n = randint(1, 6)
return n
a = int(input("Adivina el numero: "))
for i in range(a):
print adivina(i)
if a == adivina(i):
print ("Acertaste: ", a,i)
else:
print ("Fallo: ", a,i)
| true |
0f049f09728a5180d6dba89445c652a9a63b256a | Python | Ramesh1589/PythonPrograms | /PythonPrograms/10_dictonary_search_name.py | UTF-8 | 646 | 4.1875 | 4 | [] | no_license | # Program To Create Dictonary with key value and search name form Dictonary.
n = int(input('Enter number of students ::'))
d = {}
for i in range(n):
name = input('Enter student name :: ')
marks = input('Enter student marks :: ')
d[name] = marks
while True:
name = input('Enter student name to... | true |
9e69543637f8c4a078a27ff8ec3e823ba70218d5 | Python | Manish1094/Udacity--Data_Warehouse_Project | /create_tables.py | UTF-8 | 1,432 | 3.078125 | 3 | [] | no_license | # Import Libraries
import configparser
import psycopg2
from sql_queries import create_table_queries, drop_table_queries
# Drop Tables function will call the queries to drop the fact & dimension tables
def drop_tables(cur, conn):
"""
This function iterates over all the drop table queries and executes t... | true |
7c3b0f867637c28e29c21e9255ca4b199caaf43a | Python | kunalt4/ProblemSolvingDSandAlgo | /LeetCode/find_all_anagrams.py | UTF-8 | 322 | 3.125 | 3 | [] | no_license | class Solution:
def findAnagrams(self, s: str, p: str) -> List[int]:
res = []
p = "".join(sorted(p))
p_len = len(p)
print(p)
print(p_len)
for i in range(len(s)-p_len+1):
if "".join(sorted(s[i:i+p_len])) == p:
res.append(i)
return re... | true |
cdd345a1377e43ee2d7c7b8a34e06db822a062e6 | Python | liuw123/leetcode | /Q2_Add_Two_Numbers/solution.py | UTF-8 | 582 | 3.34375 | 3 | [] | no_license | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
if l1==None:
return l2
if l2==None:
return l1
cur_val = l1.val+l2.val
add_num = 0
if cur_val>9:
cur_val = cur_val-10
add... | true |