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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0b732ca9a6a612c6f91f0b86b89a5b96b4035923 | Python | adnanshahz2018/Interview-Coding-Problems | /spiralprint.py | UTF-8 | 1,387 | 3.4375 | 3 | [] | no_license | # COMPLETED
# A = [[1,2,3],
# [4,5,6],
# [7,8,9]]
# A = [ [ 1, 2, 3, 4 ],
# [ 5, 6, 7, 8 ],
# [ 9, 10, 11, 12 ],
# [ 13, 14, 15, 16 ],
# [17, 18, 19, 20],
# [21, 22, 23, 24] ]
A = [[1],[2], [3], [4], [5], [106]]
rowend = row = len(A) # the end bound... | true |
3e95fc623d9e70a283ad3f67411fba0f606a481e | Python | Jackleila/Words-frequency | /nltkTest.py | UTF-8 | 620 | 3.421875 | 3 | [] | no_license | import nltk
import matplotlib.pyplot as ptl
from nltk.corpus import stopwords
#Language selection
language = input("Language: ")
#Opening and reading file
with open(input("Enter Filename: "), 'r') as myfile:
data=myfile.read()
#Tokenizing
tokens = [t for t in data.split()]
#Removing stop words
clean_tokens = t... | true |
1bab41541c740c2e6d80b982cc9b102f01d13d69 | Python | FredrikM97/Medical-ROI | /src/roi.py | UTF-8 | 4,140 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | """
Transformation of ROI with the help of RoiAlign.
"""
from typing import List, Tuple, Union
import numpy as np
import torch
from roi_align import RoIAlign
from torchvision.ops._utils import convert_boxes_to_roi_format
from src.files.preprocess import tensor2numpy
class RoiTransform:
"""Apply ROI transform ... | true |
ef8830924b7969b19ee44bee356df159cd893d2f | Python | gulatiaditya30/Thesis | /testScripts/ftModelGenerator.py | UTF-8 | 1,776 | 2.703125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from keras import Sequential
from keras.layers import Dense
from sklearn.metrics import confusion_matrix
from sklearn.metrics import confusion_matrix
dataset = pd.read_csv... | true |
2c24e6bcb78da35c18619249fb438ae6f5d8a287 | Python | jimmy-academia/Deeper-Learnings | /codestosort/ComputerVision/yolov1/module/yololoss.py | UTF-8 | 5,685 | 2.515625 | 3 | [
"MIT"
] | permissive |
#encoding:utf-8
#
#created by xiongzihua 2017.12.26
#
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class myloss(nn.Module):
def __init__(self):
super(myloss,self).__init__()
self.S = 7
self.B = 2
self.l_coord = 5
... | true |
56b34ca49f5befe04b844cee265b3fc9ad053b87 | Python | KTH-EXPECA/ExperimentRecorder | /tests/test_experiment.py | UTF-8 | 7,043 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2021 KTH Royal Institute of Technology
#
# 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.0
#
# Unless required by appli... | true |
9459042466ad2b47960b32204dbc024d7edf5013 | Python | p2slugs/recipebox | /tester.py | UTF-8 | 3,052 | 4.125 | 4 | [] | no_license | import json
#Make a Dictionary of you, your siblings, parents, and grandparents. Have at least 4 attributes per person.
fm1 = { "name":"Linda", "age":18, "food":"cheese"}
fm2 = { "name":"Christina", "age":44, "food":"seafood", "parent":True}
fm3 = { "name":"Henry", "age":48, "food":"beef", "parent":True}
fm4 = { ... | true |
7489a431a1cd61822619b603e512f7aed1a363f7 | Python | atul7cloudyuga/stanfordkarel | /stanfordkarel/karel.py | UTF-8 | 15,609 | 3.03125 | 3 | [
"MIT"
] | permissive | """
This file defines the Karel class, which provides the actual
implementation of all functions described in the Karel Reference
Guide.
All instances of a Karel object store a reference to the world
in which they exist. Each Karel object exists on a given
(avenue, street) intersection and holds a certain number of be... | true |
755806277505a0ddd237c3205d11be972b5f1fd0 | Python | alexeyvkuznetsov/Latin_Text_Preprocessing_Python | /2/BasicNLP.py | UTF-8 | 3,189 | 2.984375 | 3 | [] | no_license | import nltk
from cltk.tokenize.sentence import TokenizeSentence
from cltk.tokenize.word import WordTokenizer
from collections import Counter
from IPython.display import Image
from cltk.stop.latin import STOPS_LIST
# See http://docs.cltk.org/en/latest/latin.html#sentence-tokenization
cato_agri_praef = "Est interdum pr... | true |
8bdc88eac09f773c27844ba64c54f2064ce187d0 | Python | Aasthaengg/IBMdataset | /Python_codes/p02678/s623249206.py | UTF-8 | 750 | 2.875 | 3 | [] | no_license | from collections import deque
N, M = map(int, input().split())
route = [[] for _ in range(N)]
for _ in range(M):
A, B = map(int, input().split())
route[A-1].append(B-1)
route[B-1].append(A-1)
ans = [-1]*(N)
def bfs():
tmp = 0
prv = 0
visited = [False]*N
kouho = deque()
for room in route[0]:
kouho... | true |
8602d3352338e5c060206213c0cdc9f0654fa320 | Python | RonElhar/IsraeliMediaTendency | /NewsSpider/news_scraper.py | UTF-8 | 3,785 | 2.890625 | 3 | [] | no_license | import re
from datetime import date
from bs4 import BeautifulSoup
from abc import abstractmethod
class NewsScraperBS(BeautifulSoup):
def __init__(self, html_page, domain_name, base_url, **kwargs):
super().__init__(html_page, features='html.parser')
self.domain_name = domain_name
self.base_... | true |
d9ce3ed16e54040b2fbdba7aaf23ccd694c1f30f | Python | luismedinaeng/holbertonschool-higher_level_programming | /0x0B-python-input_output/7-save_to_json_file.py | UTF-8 | 173 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python3
def save_to_json_file(my_obj, filename):
import json
with open(filename, mode="w", encoding="utf-8") as a_file:
json.dump(my_obj, a_file)
| true |
53c60eb1da673eb8203d89f66e52034b9de921f7 | Python | LRegan666/Athene_Leetcode | /Subsets_II.py | UTF-8 | 776 | 3.359375 | 3 | [] | no_license | class Solution:
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
if not nums:
return [[]]
tmp, res =[], []
for k in range(len(nums)+1):
self.search_subset(nums, k, tmp, res)
return res
d... | true |
aa46e9bb0686991316cdc9e0be1023626af70262 | Python | itgsod-Isak-Johansson/RomerskaSiffror | /test/romanize_test.py | UTF-8 | 1,896 | 3.5625 | 4 | [] | no_license | #encoding: utf-8
import random
from nose.tools import *
import sys
sys.path.append('..')
from romanizer import romanize
def test_romanize_takes_a_number_as_argument():
assert_raises(TypeError, romanize)
def test_romanize_number_can_not_be_negative():
with assert_raises(ValueError) as e:
romanize(rand... | true |
ee6cb546897f8ea9acb350935d275ee08bd8ce5a | Python | pints-team/pints | /pints/tests/test_nested_rejection_sampler.py | UTF-8 | 3,141 | 2.90625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
#
# Tests nested rejection sampler.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import unittest
import numpy as np
import pints
import pint... | true |
94cd33a4e9b13f15d7999e0fc2325eaf987c061c | Python | Gangezilla/notes-py | /notes/current_note_gui.py | UTF-8 | 888 | 2.953125 | 3 | [] | no_license | import tkinter as tk
class CurrentNoteGUI:
def __init__(self, frame, selected_note, save_note):
print('making current note', selected_note)
scroll = tk.Scrollbar(frame)
text = tk.Text(frame)
text.insert('end', selected_note["Content"])
button = tk.Button(text="Save", comm... | true |
5932cc723100e840e0dd88242432293bf5f52320 | Python | joechung99/Computer-Programming-and-Engineering-Application | /project1/0551287hw1.py | UTF-8 | 1,445 | 3.046875 | 3 | [] | no_license | def readfile():
import re
f = open('0551287IN.txt','r')
node=list()
bar=list()
area=list()
for line in f.readlines():
line = line.strip()
line=re.split('=|,',line)
if line[0].find('points')!=-1:
nodenum=int(line[1])
continue
elif line[0].find('p')!=-1 and line[0]!='points':
node.append(line)
... | true |
fd36d5d6269c4c51f51b94ce0405580d52815e70 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2464/60619/252822.py | UTF-8 | 405 | 3.609375 | 4 | [] | no_license | target = int(input())
num = input().split(",")
numbers = [int(i) for i in num]
lengths = []
for i in range(len(numbers)-1):
current = numbers[i]
le = 1
for j in range(i+1, len(numbers)):
current += numbers[j]
le += 1
if current >= target:
lengths.append(le)
br... | true |
da020f278b718d5ab1940672febc85b53a4ba9e1 | Python | bss233/CS126-SI-Practice | /Week 8/Palindrome with a loop.py | UTF-8 | 299 | 3.625 | 4 | [] | no_license | def palindrome(word):
word = word.lower().replace(' ', '').replace(',', '').replace("'", '')
forward = 0
backward = -1
for count in range(len(word)):
if word[forward] != word[backward]:
return False
forward += 1
backward -= 1
return True
| true |
e7f611db0296a05d900903e7a5652c9acaaecc20 | Python | Claudio5/ML_project | /project1/src/cross_validation.py | UTF-8 | 1,933 | 2.671875 | 3 | [] | no_license | import numpy as np
from proj1_helpers import *
from implementations import *
from utils import *
def cross_validation(optim_method, loss_function, tx, y, indexes_te, indexes_tr,
k_fold, isBuildPoly = False, args_optim = (), args_loss = ()):
"""Cross validation of the training set for any optimi... | true |
d8bbd3858a251a34a29eb19dd89de512a369fcd7 | Python | wenwen252/Auto-testing | /class_04/04字典.py | UTF-8 | 1,045 | 4.1875 | 4 | [] | no_license | """
============================
-*- coding:utf-8 -*-
Author :稳稳的幸福
E_mail :1107924184@qq.com
Time :2019/12/30 21:13
File :04字典.py
============================
"""
"""
字典:每一个元素都是由一个键值对(key:value)组成
字典的定义:使用花括号来表示
字典中的数据规范:
key:不能重复,只能是不可以变类型的数据(数值,字符串,元组),建议key使用字符串
value:可以是任意类型的数据
字... | true |
454b2bfa12dfec0ffcd1a2080f6921b0745326c3 | Python | lee000000/leetcodePractice | /83.py | UTF-8 | 1,052 | 3.890625 | 4 | [] | no_license | '''
83. Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.
'''
from ListNode import *
# Definition for singly-linked list.
# class ListNode(object):
# def __ini... | true |
b73b4078a1730e3123de76722dcaa44eb51e6720 | Python | houshengandt/My-Solutions-For-Show-Me-The-Code | /0000/0000.py | UTF-8 | 416 | 2.984375 | 3 | [] | no_license | from PIL import Image, ImageDraw, ImageFont
def add_num(filename, text='9', size=40, color='red'):
a = Image.open(filename)
print(a.size)
f = ImageFont.truetype("arial.ttf", size)
b = ImageDraw.Draw(a)
x, y = a.size
xy = (x - 40, y - 190)
b.text(xy, text, fill=color, font=f)
newname = ... | true |
0e70aec42f3f17d049fd079d297aab1febccdd2c | Python | davidyuqiwei/davidyu_stock | /scripts/backup/combine_all_csv.py | UTF-8 | 1,618 | 2.5625 | 3 | [
"MIT"
] | permissive | # coding: utf-8
## this script combine all the csv files in the folder
from package_path_define.path_define import *
from package_downloaddata.download_data_v1 import save_dir1
import pandas as pd
from package_functions.combine_allCsv_inFolder import combine_csv_in_folder
path_stock_owner_liutong=r'\\'.join([main_pa... | true |
f0d0e6298f56b6c49f7869b5c41745f648fa456a | Python | w8s/python-asana | /asana/resources/gen/project_statuses.py | UTF-8 | 2,554 | 2.875 | 3 | [
"MIT"
] | permissive |
class _ProjectStatuses:
"""A _project status_ is an update on the progress of a particular project, and is sent out to all project
followers when created. These updates include both text describing the update and a color code intended to
represent the overall state of the project: "green" for projects that... | true |
402c2a4d60e6c4783ee6f588c269201da0e48df8 | Python | zhuolikevin/Algorithm-Practices-Python | /Indeed/validPythonCode.py | UTF-8 | 2,522 | 3.75 | 4 | [] | no_license | # Given a list of strings. Each string represents a line of python code
# return the line number of first invalid line. If no invalid line, return -1
# rules for validation:
# 1. No indentation in the first line
# 2. There must be more indentations in the next line of control statements(if, else, for, etc)
# 3. If a li... | true |
c8f403bb85c7a0f7fe6fb049462819f44a53fc0f | Python | BiggyZable/proman-sprint-1 | /main.py | UTF-8 | 3,260 | 2.65625 | 3 | [] | no_license | from flask import Flask, render_template, url_for, request
from util import json_response
import data_handler
app = Flask(__name__)
@app.route("/")
def index():
"""
This is a one-pager which shows all the boards and cards
"""
return render_template('index.html')
@app.route("/get-boards")
@json_res... | true |
7f8e3635bf7d57fd1e0a8f684fe337075bd0e53d | Python | vihervirveli/portfolio | /AI_and_Python/Python_ImageClassificationFaceRecognition/model_best_so_far.py | UTF-8 | 9,275 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
"""
@vihervirveli project for AI and IoT.
Purpose of the project:
• Make a CNN that will determine that the pictures used in an age determining program
1. are big enough
2. have one (1) face in them
3. in addition to a face, the picture also contains face ... | true |
8a73b2e296a260dcf1269aa377e6b856307c2c63 | Python | kmcrayton7/python_coding_challenges | /programmr/strings/capitalize_me.py | UTF-8 | 212 | 4 | 4 | [] | no_license | # Write a program which capitalizes the first letter of a given string.
print "Please enter a sentence using all lowercase letters."
sentence = raw_input('> ')
sentence = sentence.capitalize()
print sentence
| true |
c1406bfb955b08e09466b9af8f50673b405b9c8c | Python | eswanson611/scripts | /archivesspace/asDeleteOrphanLocations.py | UTF-8 | 1,449 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import os, requests, json, sys, logging, ConfigParser, urllib2, pandas
config = ConfigParser.ConfigParser()
config.read('local_settings.cfg')
# Logging configuration
logging.basicConfig(filename=config.get('Logging', 'filename'),format=config.get('Logging', 'format', 1), datefmt=config.get('Log... | true |
b25465e5fb9c7d58869adb86287d167e6ac49bc8 | Python | nintex00/bfun | /perceptron_OR.py | UTF-8 | 1,083 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 3 20:47:56 2016
@author: Brad
"""
import numpy as np
import matplotlib.pyplot as plt
input = np.matrix('0 0; 0 1; 1 0; 1 1')
numIn = 4
desired_out = np.matrix('0; 1; 1; 1')
bias = -1
coeff = 0.7 # learning rate
weights = -1*2*np.random.rand(3,1)
iterations = 1000
rms... | true |
27a9e101cd4a7f253db5f5c89fb3068918340ead | Python | DilyanTsenkov/SoftUni-Software-Engineering | /Python Fundamentals/03 Lists Basics/Exercises/07_Easter_Gifts.py | UTF-8 | 870 | 2.953125 | 3 | [] | no_license | gifts_names = input().split(" ")
command = input()
while command != "No Money":
command_list = command.split(" ")
if command_list[0] == "OutOfStock":
if command_list[1] in gifts_names:
for i in range(len(gifts_names)):
if gifts_names[i] == command_list[1]:
... | true |
bcddd2dc3a8c7cf035536ff1248f0e35913cc880 | Python | INfoUpgraders/rblxpy | /rblxpy/__init__.py | UTF-8 | 372 | 2.71875 | 3 | [
"MIT"
] | permissive | import urllib.request, json
class Users:
def __init__(self, username):
self.username = username
def get_user(self):
with urllib.request.urlopen(f"http://api.roblox.com/users/get-by-username?username={self.username}") as url:
data = json.loads(url.read().decode())
return da... | true |
3e6a36efb6a4efb1c03791376a5aa331008782e6 | Python | joewledger/ProjectEuler | /Problems/Euler20/Euler20.py | UTF-8 | 391 | 3.40625 | 3 | [] | no_license | #Project Euler Problem 20
#Description: Find the sum of the digits in the number 100!
import os
import sys
if(len(sys.argv) > 1):
os.chdir(sys.argv[1])
sys.path.append("../../Utils")
sys.path.append("Utils")
import operator
import integer_utils
factorial = reduce(operator.mul, [x for x in xrange(1,101)],1)
print... | true |
ee40939b51d168f08137b3e6b4abf062e15cc0e0 | Python | k-data/Streamlit-Titanic-Machine-Learning-from-Disaster | /streamlit/python/basic_ml.py | UTF-8 | 4,200 | 3.15625 | 3 | [] | no_license | """ basic_ml.py """
import pandas as pd
import seaborn as sns; sns.set(font='DejaVu Sans')
import matplotlib.pyplot as plt
import streamlit as st
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from xgboost import XGBClassifier
from lightgbm import LGBMClassifier... | true |
89bde37cca3554a7881dbd5a102cafe7140ef125 | Python | J3rryCodes/AI_python | /XOR_problem_solving_ai/XOR_nn.py | UTF-8 | 2,162 | 3.390625 | 3 | [
"Unlicense"
] | permissive | #XOR problem
import numpy as np #matrix math
#input vlues
X = np.array([[0,0],
[1,0],
[0,1],
[1,1]])
#utputvalues
y = np.array([[0],
[1],
[1],
[0]])
class nuralnetwork:
no_epoches = 100000
learnig_rate = 0.001
ih_weights = 2 * np.random.random((2,3)) - 1 #weights b/w input layer and hidden layer [... | true |
cf67c3593024181f627691cf7f9f5c9bf2eef46c | Python | rapchen/LeetCode_Python | /contests/20201206/5617. 设计 Goal 解析器.py | UTF-8 | 300 | 2.953125 | 3 | [] | no_license | """
@Difficulty : E
@Status : AC
@Time : 2020/12/6 10:26
@Author : Chen Runwen
"""
class Solution:
def interpret(self, command: str) -> str:
return command.replace('()', 'o').replace('(al)', 'al')
if __name__ == '__main__':
print(Solution().interpret())
| true |
beaffbf8c4250428fdee3a7f6d76689f03dc4a69 | Python | dmontealegre/pa_graphs | /PA_graph.py | UTF-8 | 1,209 | 3.359375 | 3 | [] | no_license | import networkx as nx
import matplotlib.pyplot as plt
import random
import copy
import numpy as np
import pylab
import math
import pickle
# The following function creates a graph that creates a graph that follows the preferential attachment model.
# networkx library comes with a different implementation of... | true |
1371edb870e847a98875de6f05cfcf58934c4f54 | Python | Luispapiernik/Guane-Inter-FastAPI | /app/models/dog.py | UTF-8 | 680 | 2.828125 | 3 | [
"MIT"
] | permissive | import datetime
from typing import Optional
from pydantic import BaseModel, HttpUrl
class BaseDog(BaseModel):
name: str
birth_date: Optional[datetime.datetime]
picture: Optional[HttpUrl]
is_adopted: bool
id_user: Optional[str]
# se crea esta clase por consistencia en los nombres
class DogIn(Base... | true |
6cbe44b60613b93715a72adea0697d8f5719250a | Python | yatish0492/PythonTutorial | /pandas/0_Introduction.py | UTF-8 | 550 | 2.8125 | 3 | [] | no_license | '''
What is Pandas?
It is is a library of python which provides functions to do data analytics.
What is Data Mungling/Wrangling?
It is the process of cleaning messy data. Say like if some of the data is missing then we can fill them with 0 or
any value so that we can easily process the data with analytic... | true |
02a53441dac8c4d1d202e5dee750a94f3ed5553d | Python | RickyL-2000/ZJUI-lib | /PHYS212/unit5_hw2.py | UTF-8 | 299 | 3.125 | 3 | [] | no_license | import math
epsilon = 8.85e-12
pi = 3.1415
# Q1
g = 2.3
h = 7
deltaV = (-3/2*7*7) - (-3/2*2.3*2.3)
print(deltaV)
# Q3
lam = 2.8e-6
# Ex = lam/(2*pi*epsilon*x)
c = 3
d = 7
V3 = lam/(2*pi*epsilon) * (math.log(7)-math.log(3))
print(V3)
# Q4
sigm = 1.1e-6
V4 = sigm/(2*epsilon)*(0.2-1.9)
print(V4)
| true |
8be5eb81da94c5b68cc57ab922d8a6cf364f2007 | Python | sakurasakura1996/Leetcode | /二叉树/problem95_不同的搜索二叉树II.py | UTF-8 | 3,957 | 3.890625 | 4 | [] | no_license | """"
95. 不同的二叉搜索树 II
给定一个整数 n,生成所有由 1 ... n 为节点所组成的 二叉搜索树 。
示例:
输入:3
输出:
[
[1,null,3,2],
[3,2,null,1],
[3,1,null,null,2],
[2,1,3],
[1,null,2,null,3]
]
解释:
以上的输出对应以下 5 种不同结构的二叉搜索树:
1 3 3 2 1
\ / / / \ \
3 2 1 1 3 2
/ / \ ... | true |
75e492a97355d5dea483a044ed68a0c54b57ae9d | Python | jeremy-codes/rosalind | /solutions/bioinformatics_stronghold/020-revp.py | UTF-8 | 734 | 2.84375 | 3 | [] | no_license | """Solution for Bioinformatics Stronghold Problem ID: REVP
Problem Title: Locating Restriction Sites
Link: http://rosalind.info/problems/revp
"""
import rosalindutils.dna_functions as dnaf
from rosalindutils.fasta_parser import FastaParser
input_path = "data/rosalind_revp.txt"
seq_objs = FastaParser(input_path).pars... | true |
601227337d264d59a927830d6c8ae6032fa20156 | Python | huyson1810/VS_speech_processing | /test/test_2.py | UTF-8 | 251 | 2.796875 | 3 | [] | no_license | from tkinter import *
from PIL import ImageTk
canvas = Canvas(width=1000, height=800, bg='blue')
canvas.pack(expand=YES, fill=BOTH)
image = ImageTk.PhotoImage(file="../virtual_ass.gif")
canvas.create_image(10, 10, image=image, anchor=NW)
mainloop() | true |
0b97b270abc818bf7d2defc031369da7d2ecd11d | Python | ruthierutho/karaoke_homework | /codeclan_caraoke/tests/room_test.py | UTF-8 | 3,894 | 3.140625 | 3 | [] | no_license | import unittest
from classes.room import *
from classes.song import *
from classes.guest import *
class TestRoom(unittest.TestCase):
def setUp(self):
self.song1 = Song("I'm a Slave 4 u", "Britney Spears")
self.song2 = Song("Toxic", "Britney Spears")
self.song3 = Song("...Baby One More Tim... | true |
eca7afd8799ccdb53e79aabd253dd5da7e8e9f44 | Python | briandleahy/globaloptimize | /util/heap.py | UTF-8 | 3,750 | 4.15625 | 4 | [] | no_license | from collections import deque
class Heap(object):
"""
A data structure which efficiently keeps the min value at the top.
Both adding an object to the heap and popping the minimum object
from the heap take O(log(N)) operations.
Methods
-------
create_from_iterable: iterable -> Heap
ad... | true |
eb42a64b2dd667e7b840237591c79dacfc507ddb | Python | JeterG/Post-Programming-Practice | /CodingBat/Python/List_2/has22.py | UTF-8 | 240 | 3.4375 | 3 | [] | no_license | #Given an array of ints, return True if the array contains a 2 next to a 2 somewhere
def has22(nums):
temp=0
for num in nums:
if temp==2 and num==2:
return True
else:
temp=num
return False | true |
37b44c85595b4ec7642bae59f055e3df2becf1cf | Python | Keine-Ahnung/secWebAw | /webapp/tralala/function_helper.py | UTF-8 | 5,906 | 2.75 | 3 | [] | no_license | import random
import smtplib
import string
import db_handler
import security_helper
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send_mail_basic(to, subject, text_mail_body, html_mail_body=None):
"""
Method to send Mails using a gmx account
"""
sender = "ve... | true |
4685a14fa7ea4489ba2d21826e3af52d922eddb0 | Python | aqknutsen/AlecAlexMarchMadnessMania | /GetIndividualInfo.py | UTF-8 | 2,828 | 2.875 | 3 | [] | no_license | from urllib.request import urlopen
import sqlite3
from bs4 import BeautifulSoup
class GetIndividualStats:
def __init__(self):
pass
def get_stats(self):
url = 'http://www.espn.com/mens-college-basketball/teams'
player_links = []
team_name = []
try:
response... | true |
06612951cf0f1886c222f71f48d13145c3b56b60 | Python | lllttzz/my_code | /项目上位机/Myline.py | UTF-8 | 2,126 | 2.78125 | 3 | [] | no_license | from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import argparse
#绘制曲线主函数
def Mymain(x,y,im,am,pos,dir):
plt.clf()
n = ['rt','gt','bt']
for i in range(3):
n[i] = im[i].getdata() #获取图片参数
n[i] = np.matrix(n[i]) #转换为矩阵
n[i] = np.reshape(n[i],(x,y))
a = rang... | true |
e2ca120ff6ab891b2413a2f78332752fac464b48 | Python | emapco/Python-Code-Challenges | /merge_csv_files.py | UTF-8 | 1,765 | 3.203125 | 3 | [] | no_license | import csv
import pandas as pd
import numpy as np
# merges multiple CSV files into one utilizing pandas library
def merge_csv_files(input_files, output_file_path):
input_dfs = [pd.read_csv(file, index_col=0) for file in input_files]
if not input_dfs:
return
output_df = input_dfs[0]
for i in ra... | true |
03dae043060cfea719488a6d899c2afc81298cdd | Python | GraceDurham/coding_challenges_coding_bat | /pos_neg.py | UTF-8 | 393 | 3.90625 | 4 | [] | no_license |
# Given 2 int values, return True
# if one is negative and one is positive.
# Except if the parameter "negative" is True, then return True only if both are negative.
def pos_neg(a, b, negative):
if negative:
return ( a < 0 and b < 0)
else:
return ((a < 0 and b > 0 ) or (a > 0 and b < 0))
print(pos_neg... | true |
a2ae95721b14e5232ca7ab17b15a47451343257f | Python | arielmiki/playit-lite | /model.py | UTF-8 | 985 | 2.921875 | 3 | [] | no_license | import enum
import pickle
class MouseKeyboardEvent:
class Type(enum.Enum):
MOUSE_ON_MOVE = 0
MOUSE_ON_SCROLL = 1
MOUSE_ON_CLICK = 2
KEYBOARD_ON_PRESSED = 3
KEYBOARD_ON_RELEASED = 4
@staticmethod
def decode(byte):
return pickle.loads(byte)
@staticmethod
... | true |
0cfc56359c3f89e737cbc643c7d9d224fc41c9bd | Python | rafiparvez/urlshortener | /url_shortener_proj/url_shortener_app/schema.py | UTF-8 | 1,147 | 2.546875 | 3 | [] | no_license | import graphene
from graphene_django.types import DjangoObjectType, ObjectType
from .models import UrlModel
"""
Class to manage GraphQL schema
"""
# Create a GraphQL type for the url model
class UrlType(DjangoObjectType):
class Meta:
model = UrlModel
class QueryType(graphene.ObjectType):
urls = grap... | true |
cf6abde98117d67308616864e043a34778efd5aa | Python | Mariamawatt/TP_Ateliers_Prog | /AP3/exercice3.py | UTF-8 | 543 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 15:49:41 2020
@author: Mariama
"""
def separer(L_non_triee : list)->list:
LSEP = []
liste_negative =[]
liste_nulle = []
liste_positive = []
for elt in L_non_triee:
if elt < 0 :
liste_negative.append(elt)
elif elt ==... | true |
671a52ee2ee5714f55c9418415d3eb0e66bd7d3b | Python | ashutosh117/rosalind_problems | /stronghold/gc_content.py | UTF-8 | 768 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 6 13:48:25 2020
@author: t1
"""
def readFile(file_path):
with open(file_path,'r') as f:
return [l.strip() for l in f.readlines()]
def gc_content(dna_seq):
return ((dna_seq.count('C') + dna_seq.count('G')) / len(dna_seq)*1... | true |
b501766cde2f305ee39e1f7644619353cb7192dd | Python | heliosantos/clipboard_text_processor | /clipboard_text_processor/format_http_request.py | UTF-8 | 890 | 2.859375 | 3 | [] | no_license | import re
from .decorators import use_clipboard
@use_clipboard
def format_http_request(raw):
output = []
lines = [l.strip('\r\n') for l in raw.split('\n')]
output.append(lines.pop(0))
headers = []
headersDict = {}
while h := lines.pop(0):
headers.append(h)
if m := re.search(r... | true |
b7f8ee9316bec41e7711610b3be3135df4b05b4d | Python | muhammadmisbah/SPSSexe-installed-pckg | /IBM/SPSS/Statistics/21/Samples/Make Significant Values Bold And Red.py | UTF-8 | 6,385 | 2.75 | 3 | [] | no_license | #/***********************************************************************
# * IBM Confidential
# *
# * OCO Source Materials
# *
# * IBM SPSS Products: Statistics Common
# *
# * (C) Copyright IBM Corp. 1989, 2011
# *
# * The source code for this program is not published or otherwise divested of its trade secrets,
# * i... | true |
5107ba5385db212a00762934e87840232b82800a | Python | kubapok/AI_2017 | /coordinates-recognition/main.py | UTF-8 | 7,682 | 2.640625 | 3 | [] | no_license | from ImageToArrays import ImageToArrays
import math
import os
import copy
import PIL.Image
import numpy as np
import random
import sys
import pdb
import time
np.set_printoptions(threshold=np.nan)
start_time = time.time()
impath = 'python-image-recognition/images/numbers'
def getDigitImgs(digit):
kk = [ a for a... | true |
598630d749939c244d249bc8438219d8eb99c541 | Python | IC-H/16_Always_On | /combine_4th.py | UTF-8 | 13,631 | 2.671875 | 3 | [] | no_license | import cv2
import os
import numpy as np
import math
import scipy as sp
import matplotlib.pyplot as plt
def imTrim(img, points):
p1 = points[0]
p2 = points[1]
if p1[0] > p2[0]:
x1 = p2[0]
x2 = p1[0]
else:
x1 = p1[0]
x2 = p2[0]
if p1[1] > p2[1]:
y1 = p2[1]
y2 = p1[1]
else:
y1 = p1[1]
y2 = p2[1]
... | true |
58aeff945165905bb2005a1ed8988fa12b775e89 | Python | CZ-NIC/deckard | /pydnstest/mock_client.py | UTF-8 | 4,628 | 2.703125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | """Module takes care of sending and recieving DNS messages as a mock client"""
import errno
import socket
import struct
import time
from typing import Optional, Tuple, Union
import dns.message
import dns.inet
SOCKET_OPERATION_TIMEOUT = 5
RECEIVE_MESSAGE_SIZE = 2**16-1
THROTTLE_BY = 0.1
def handle_socket_timeout(s... | true |
da47bd6c0e68aa8506a8b903d8ddc74e04a8ddec | Python | MeztliVal/Python_Codes | /PRINCIPIANTES/manejo de archivos csv y xml/modif_arch.py | UTF-8 | 699 | 3.0625 | 3 | [] | no_license | #modificando archivos
#importando libreria nuestra para manejo de archivos
import lib20
print("Rellenando archivos...")
nombre = input("Teclea el nombre del archivo con extension .txt al que deseas agregar un registro:")
resp = 's'
while resp == 'S' or resp == 's':
print("Ingresa los siguientes datos:")
ncontro... | true |
1a262354c8be5a2ca4eb1570da679bf3cd4b507e | Python | yuriivs/geek_python_less02_dz | /lesson02_dz02.py | UTF-8 | 767 | 4.4375 | 4 | [] | no_license | # Для списка реализовать обмен значений соседних элементов, т.е.
# Значениями обмениваются элементы с индексами 0 и 1, 2 и 3 и т.д.
# При нечетном количестве элементов последний сохранить на своем месте.
# Для заполнения списка элементов необходимо использовать функцию input().
# mylist = [2, 8, 43, 15, 907, 33, "inte... | true |
a61c572018cfaec675195f3b9f56b2ad933f46f0 | Python | veervohra03/Processing | /Python/sineZipper/sineZipper.pyde | UTF-8 | 1,131 | 3.515625 | 4 | [] | no_license | # Veer Vohra
# Sine Zipper
# Python Ver 1.0
t = 0
x = []
objs = 30
beg = 0
def setup():
global beg
size(1000, 800)
smooth()
inter = 20
beg = (width-(inter*objs))/2 - 5
temp = 20
for i in range(objs):
x.append(temp)
temp += inter
def draw():
glo... | true |
ca31b6e81740b1b8c32e8a8270385f2ca79d0788 | Python | thailore/RandomCodes | /CodeAcademy/machine-learning/titanic_survival/TitanicSurvival_RandomForest.py | UTF-8 | 2,288 | 3.875 | 4 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
# Load the passenger data
passengers = pd.read_csv("passengers.csv")
print(passengers.info()) # print range index and types of... | true |
86eee1bfdeda0258ff9db13bd7af0b662a29003a | Python | chwgcc/hogwarts_chw | /python_practice/game/game_round_more.py | UTF-8 | 711 | 3.734375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/10/23 17:12
# @Author : chw
# @File : game_round_more.py
# 定义fight函数实现游戏逻辑
def fight():
# 定义四个变量来存放数据
my_hp = 1000
my_power = 200
enemy_hp = 1000
enemy_power = 199
# 加入循环,让游戏可以进行多轮
while True:
my_hp = my_hp - enemy_power
enem... | true |
96a4abc4ba336875e8a78f492dfe7b47be83e8cd | Python | Edwinroman30/Python_practices | /To_Practices/Intermediate_Practices/Exercise03.py | UTF-8 | 241 | 3.578125 | 4 | [] | no_license | #Studen: Edwin Alberto Roman Seberino.
#Enrollment: 2020-10233
"""
3. Hacer un programa que genere las tablas de multiplicar de los números múltiplos de 5 que hay entre 1 y 500.
"""
i=0
for i in range(500):
i= i + 1
if((i%5) == 0):
print(i)
| true |
589e4f2b44ab4b38396412da0f73dfa131d09412 | Python | meunierd/romexpander | /romexpander.py | UTF-8 | 4,711 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""romexpander.py
Usage:
romexpander.py [options] [INPUT]
romexpander.py [-h | --help]
romexpander.py [-v | --version]
Arguments:
INPUT optional input ROM file.
Options:
-v, --version show version info.
-h, --help ... | true |
23042dbd9b34104bce8baa62b299fcb1d7cdc675 | Python | eyalho/Cyber_APT_Reports_NER | /creating_data/A1_convert_pdf_to_txt.py | UTF-8 | 1,015 | 2.640625 | 3 | [] | no_license | from pathlib import Path
import pdftotext
from config import GIT_1_SOURCE_DIR, GIT_1_TXT_DIR
def pdftotext_converter(source_pdf_dir, dst_txt_dir):
source_pdf_dir = Path(source_pdf_dir)
dst_txt_dir = Path(dst_txt_dir)
print(f"pdf_dir : {source_pdf_dir}")
print(f"dst_txt_dir : {dst_txt_dir}")
bad_... | true |
4c8c78e4e649bc0f6673c6fdeaf0ce8cfd2684d1 | Python | mehedi-shafi/word-scrabble-bot | /pathfinder.py | UTF-8 | 1,364 | 2.90625 | 3 | [] | no_license | def backTrack(target, word, node, graph, path=[]):
if len(word) == 0:
formedWord = ''
for _ in path:
formedWord += _.character
if formedWord == target:
return path
return False
adjacencyList = graph[node]
adjacencyCharacterList = [x.ch... | true |
35b6a0f73cd38f05450012d3f55d775554e0dc5a | Python | wilsonwang371/pyalgotrade | /pyalgotrade/fsm.py | UTF-8 | 3,259 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | #state machine
import enum
import inspect
import sys
import pyalgotrade.logger
logger = pyalgotrade.logger.getLogger(__name__)
def state(state_enum, is_initial_state=False):
def wrapper(func):
''' decorator for state machine
'''
assert callable(func)
assert isinstance(state_enum... | true |
f7b6df67cc6eb1afc80ff0e4ef28bfad82c6100c | Python | ojasagg/Time-Table-Solver | /GA.py | UTF-8 | 5,217 | 2.765625 | 3 | [] | no_license | from collections import OrderedDict
import random
import heapq
import time
best_ans=[]
best_ans_val=0
#Print answer
def output():
subject=[0]*M
arr=[]
row=[0,0,0,0,0,0,0,0]
for j in range(5):
arr.append(row[:])
for j in range(0,5):
for k in range(0,8):
arr[j][k]=[]
for j in range(int(M/2)):
subject[j]=... | true |
ee24e575c5a9a8df45411807b64a6c3b911a3f7e | Python | foldvaridominic/taboos | /aux.py | UTF-8 | 10,495 | 2.65625 | 3 | [] | no_license | import logging
import random
from collections import Counter, defaultdict
from functools import reduce
from itertools import combinations
import networkx as nx
logger = logging.getLogger()
logger.setLevel(logging.INFO)
ch = logging.StreamHandler()
ch.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(mes... | true |
f022a76ad25582ab2e9fa434477acb618d8c1411 | Python | acnar/CombinedLIFX_Alexa_Python | /lifx_manager.py | UTF-8 | 8,070 | 2.515625 | 3 | [] | no_license | import configparser
from copy import deepcopy
from lifxlan.lifxlan import *
from time import time
""""
Class for managing LIFX devices.
"""
class LIFXManager:
LIGHTS_DOWN = 0
LIGHTS_RESTORED = 1
LIGHTS_CHANGED = 2
def __init__(self):
config = configparser.ConfigParser()
c... | true |
2164b54d75a8ae11f9dc293a76602a5a7f9d5b2b | Python | slee17/NLP | /sentimentAnalysis/sentimentAnalysis.py | UTF-8 | 8,224 | 2.796875 | 3 | [] | no_license | from nltk.twitter import Streamer, TweetWriter, credsfromfile
from nltk.twitter.common import json2csv
from nltk.corpus import stopwords, opinion_lexicon
from sklearn.dummy import DummyClassifier
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.cross_validation import KFold
from sklearn.naive_b... | true |
815752b58dc12026c1694f77fa88e7c3b7c009e6 | Python | CeliaGM5/Incu2020 | /API/APIs/send_message.py | UTF-8 | 3,326 | 2.546875 | 3 | [] | no_license | from flask import Flask, request
import requests
import json
import pymongo
############## Bot details ##############
bot_name = 'extra_lessons@webex.bot'
roomId = "Y2lzY29zcGFyazovL3VzL1JPT00vZTQ4MjhlOTAtNzliZS0xMWVhLWE1YjctYWRiMmUxMDFiOWRi"
token = 'M2FiNGM1NzItMGZhZi00OGUxLWFjMjItNzMxMDIyNzE3ZDU2NTE0YmE... | true |
683b0b610b7fd8011d20565f2c60e1a7d4f460ad | Python | vksychev/PythonPlayground | /PG/file.py | UTF-8 | 863 | 3.21875 | 3 | [] | no_license | import os
import tempfile
class File:
def __init__(self, path):
self.path = path
with open(path, "a+") as f:
f.seek(0)
self.file_lines = f.readlines()
self.current = 0
def write(self, string):
with open(self.path, "w") as f:
f.write(stri... | true |
e5c0caf48350840d1b5b73276ec63db873a7bc35 | Python | eniche-akim/ChessAI | /play_chess.py | UTF-8 | 1,158 | 2.671875 | 3 | [] | no_license |
from __future__ import print_function
import os
import chess
import time
import chess.svg
import traceback
import base64
from state import State
import torch
from train_model import ConvNetwork
class Valuator:
def __init__(self, board = None):
vals = torch.load("Data/value.pth", map_location=lambda storage, loc... | true |
f5732184f087edf933a6ff319228c350237db4f4 | Python | Deepakdk7/Playerset3 | /41.py | UTF-8 | 146 | 2.890625 | 3 | [] | no_license | ax=list(map(int,input().split()))
a=ax[0]
b=ax[1]
for i in range(0,a):
if (b**i)==a:
print('yes')
break
else:
print('no')
| true |
33475ef16b8d31a99ad6563df763386b16e72a89 | Python | szazyczny/MIS3640 | /Session05/turtle-demo.py | UTF-8 | 3,256 | 4.25 | 4 | [] | no_license | #TURTLE MODULE
# import turtle
# jack = turtle.Turtle() #importing module and using class called turtle
# jack.fd(100) #call a method, this means forward 100 pixels, draw a horizontal line
# jack.lt(90) #lt means left turn 90 degrees
# jack.fd(100)
# jack.lt(90)
# jack.fd(100)
# jack.lt(90)
# jack.fd(100) #to draw a ... | true |
8f85e62bbe93cfbbb64527373f5bb6fa214bb979 | Python | JuliaYu2002/HunterDE | /Comp Sci 127 hw/attendanceGraph_jy.py | UTF-8 | 561 | 3.390625 | 3 | [] | no_license | #Name: Julia Yu
#Date: October 18, 2019
#Email: julia.yu83@myhunter.cuny.edu
#This program plots attendance on a graph from a specified file and saves it to another
import pandas as pd
import matplotlib.pyplot as plt
inFile = input("Enter name of input file: ")
outFile = input("Enter name of output file: ")
... | true |
8fe81d7d9431106a801486d2f8dfc44150d804b0 | Python | athikrishnarao/Python_Anaconda_code | /Pycharm_Program/Program/Test.py | UTF-8 | 597 | 3.796875 | 4 | [] | no_license | """a=int(input("enter number"))
if a>1:
for x in range(2,a):
if(a%x)==0:
print("not prime")
break
else:
print("Prime")
else:
print("not prime")"""
class airport:
def checkin(self):
name = input("What is Your Name : ")
flight_name = input("Flight Name :... | true |
abb98dae65e7ed2dfe9bf7d43c6dec01e54b6b37 | Python | Uabanur/OddJobs | /Python/MachineLearning/Project2/LinearRegression_AttributeResiduals.py | UTF-8 | 2,573 | 2.625 | 3 | [] | no_license | import matplotlib.pyplot as plt
from scipy.io import loadmat
import sklearn.linear_model as lm
from sklearn import cross_validation
from toolbox_02450 import feature_selector_lr, bmplot
import csv
import numpy as np
count = 214
# labels = ['RI', 'Na', 'Mg', 'Al', 'Si', 'K', 'Ca', 'Ba', 'Fe', 'Type']
labels = ['Na', 'M... | true |
6159880ff07097192abb0dd39bbe243ea9d7b1e5 | Python | bennytzang/python-traning | /multimatrix.py | UTF-8 | 835 | 3.359375 | 3 | [] | no_license | import numpy as np
def matrixMul(A, B):
res = [[0] * len(B[0]) for i in range(len(A))]
for i in range(len(A)):
for j in range(len(B[0])):
for k in range(len(B)):
res[i][j] = A[i][k] * B[k][j]
return res
def matrixMul2(A, B):
return [[sum(a * b for a, b in zip(a, b)... | true |
d49b13782c55b12c125d4098b74b7c2905ccf5e0 | Python | timedcy/ndnlp-penne-19336a258d30 | /examples/rnnlm2.py | UTF-8 | 1,362 | 2.9375 | 3 | [
"MIT"
] | permissive | """
Another implementation of a deep recurrent language model. This one
stacks RNNs by computing the entire output sequence of one RNN before
feeding to the next RNN up.
"""
import sys, time
sys.path.append("..")
from penne import *
from penne import lm
from penne import recurrent
import numpy
hidden_dims = 100
depth... | true |
45d2f17079bf8fb6c40e023e84d6f1cfa262d6c6 | Python | malavika545/python | /assignment-2/listproduct.py | UTF-8 | 267 | 3.5625 | 4 | [] | no_license | '''13. Compute given Num_tuple = (5, 6,8 ,3,9,1) to get desired output
Output: Out_list = [5, 30, 240, 720, 6480, 6480]
'''
num_tuple=(5,6,8,3,9,1)
out_list=list()
pro=1
for i in num_tuple:
pro=pro*i
out_list.append(pro)
print("out_list: ",out_list) | true |
59a608e0d7ba5fba9841711121336292506c95f2 | Python | mkomod/cv_docs | /python-examples/src/06_drawing_with_mouse.py | UTF-8 | 454 | 2.84375 | 3 | [] | no_license | import numpy as np
import cv2 as cv
img = np.full((512, 512, 3), 251.0)
cv.namedWindow('image')
def draw_circle(event, x, y, flags, params):
''' Callback function that draws a circle '''
if event == cv.EVENT_LBUTTONDBLCLK:
cv.circle(img, (x, y), 100, (255, 0, 0), 1)
cv.setMouseCallback('image', draw_... | true |
eeb4e16044ee4a310daeb8775cf2560e16c6fbc1 | Python | NicholasAKovacs/SkillsWorkshop2018 | /Week01/Problem03/nkruyer_03.py | UTF-8 | 796 | 3.640625 | 4 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 11 21:19:54 2018
@author: nkruyer3
"""
#Week 1 Assignment: Problem 3 - Nick Kruyer
#Correct anser 6857
n = 600851475143
#define function to determine if a number is prime
#if test = 1, number is not prime. If test = 0, number is prime
def prime(x):
test = 0
for... | true |
27f22a839fd9798d76db8c4f6354fa81f46ef2cf | Python | bennettyardley/martingale-sim | /start.py | UTF-8 | 1,948 | 3.53125 | 4 | [] | no_license | '''
start = float(input("USD: $"))
start = start * 0.0058
x = start
total = 0
win = .495
lose = .505
print("\n" + str(start) + "\n")
print("BET\t\tLOSS\t\tCHANCE")
print(str(start) + "\t\t" + str(1) + "\t\t50.5%")
for i in range(16):
x = x * 2
ud = x * 171.40
total = total + x
chan... | true |
2e60fd869db490a7e443bf618e1b18cfeef6da91 | Python | maryraven/cfg | /main.py | UTF-8 | 670 | 3 | 3 | [] | no_license | from __future__ import division # Python 2 users only
import nltk, re, pprint
from nltk import word_tokenize
with open('input_file.txt') as f:
raw = f.readlines()
input = [l.strip().split() for l in raw]
print(input)
# http://www.nltk.org/book/ch08.html
calc_grammar = nltk.CFG.fromstring("""
... | true |
15c175639412294c3168f879f3186b438a8234c8 | Python | FLNacif/URIProblems | /src/1116.py | UTF-8 | 207 | 3.828125 | 4 | [] | no_license | quantidade = int(input())
for i in range(quantidade):
x,y = input().split(" ")
x = int(x)
y = int(y)
if y == 0:
print("divisao impossivel")
else:
print("%.1f"%(x/y)) | true |
2856e1eb0b9003d7c91d0040ca1d06d3b8eae323 | Python | shasank27/Tic-Tac-Toe | /main.py | UTF-8 | 2,947 | 3.5 | 4 | [] | no_license | lis = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
def line():
print(" | |")
def inline(lis, ind):
print(" {} | {} | {}".format(lis[ind], lis[ind + 1], lis[ind + 2]))
def stline():
print("---------------")
def printmat():
for i in range(0, 9, 3):
line()
i... | true |
036408ba33973c449c5c62f96f8cd59e05374c90 | Python | Patton97/Patton97.github.io | /Research/Blockly/base.py | UTF-8 | 5,157 | 2.828125 | 3 | [] | no_license | from microbit import *
from random import randint
import neopixel
import music
I2caddr = 0x10
isRunning = True
isCrashed = False
isComplete = False
# --------------------------------------------------------------------------------
# UTILITY FUNCTIONS --------------------------------------------------------------
# --... | true |
b09ee3267fc5b14eedfb18a4f61c5794a08443d9 | Python | wangjs/Lintcode | /(407)加一.py | UTF-8 | 852 | 4.21875 | 4 | [] | no_license | '''
给定一个非负数,表示一个数字数组,在该数的基础上+1,返回一个新的数组。该数字按照大小进行排列,最大的数在列表的最前面。
思路:将数字数组转换成整数,然后求得加一的值,将这个值再转换成数字数组,最大的数在数组的前面(采用倒序一下就可以了)
'''
class Solution:
# @param {int[]} digits a number represented as an array of digits
# @return {int[]} the result
def plusOne(self, digits):
# Write your code here
... | true |
3095dfa9dbc93fc3b855f6bf2077c2a700060312 | Python | enaut/snake | /game.py | UTF-8 | 5,712 | 3.34375 | 3 | [] | no_license | from tkinter import *
from time import sleep
class Spiel():
"""
Diese Klasse macht das programmieren eines Pixelspiels mit
Python einfach.
Der Entstanden ist diese Datei für den Unterricht der
Waldorfschule Uhlandshöhe.
Der Quelltext wird unter den Bedingungen der GPL V3 oder höher
pu... | true |
b75202401a8c3043571201997b15e414b7b5905d | Python | ryanmcf10/game-engine | /env/tools/pathfinder.py | UTF-8 | 2,683 | 3.078125 | 3 | [] | no_license | import env.tools.grid as grid
import heapq
def heuristic(a, b):
(x1, y1) = a
(x2, y2) = b
return abs(x1-x2) + abs(y1-y2)
def a_star_search(graph, start, goal):
frontier = PriorityQueue()
frontier.put(start, 0)
came_from = {}
cost_so_far = {}
came_from[start] = None
cost_so_far... | true |
fc91e2cb52310675d1d250eb3aca14bda40fc29e | Python | zongmingshu/Malicious-URL-Detection | /cnn2.py | UTF-8 | 4,441 | 2.65625 | 3 | [] | no_license | import torch.nn as nn
import torch
import numpy as np
from common import get_batch,get_train_datas,get_data,ont_hot
class CNN(nn.Module):
def __init__(self):
super(CNN,self).__init__()
self.conv1 = nn.Sequential(
nn.Conv2d(
in_channels=1,
out_channels=64,... | true |
af7a8b060d27c7f69d0c45c8ffb2fcdf2d5ac6e4 | Python | bongbong3/Study | /Algorithm/Algorithm for Everyone/trainint01/Intro/Intro/Palindrome.py | UTF-8 | 775 | 4.40625 | 4 | [] | no_license | '''
Created on 2018. 3. 11.
@author: kfx20
'''
# 주어진 문장이 회문인지 찾기(큐와 스택 이용)
# 문자열 s
# 회문이면 true, 아니면 false
def palindrome(s):
# 큐와 스택을 리스트로 정의
qu = []
st = []
# 1단계 : 문자열의 알파벳을 큐와 스택에 넣음
for x in s :
# 해당 문자가 알파벳이면
# 큐와 스택에 각각 추가
if x.isalpha():
qu.append(x.lower... | true |
c6f9a63472ca5b5d854c3b6e566402c09c44992f | Python | yinruei/python- | /python_exercise/def_fun.py | UTF-8 | 118 | 3.375 | 3 | [] | no_license | def dividing_line(symbol, count):
for i in range(count):
print(symbol, i, end="\n")
dividing_line('@', 10) | true |
f21fea993f22f296770415c12bf417b7899e0d58 | Python | EKI-INDRADI/eki-latihan-python | /latihan_python_basic/32_argument_list.py | UTF-8 | 522 | 4.0625 | 4 | [] | no_license | # Belajar Argument List
#*list_angkat maksud dari * <<< adalah bisa menambahkan angka lebih dari 1
# def jumlahkan( x , *list_angka): <<<< jika ingin menambahkan parameter lain maka * hrs di tambahkan di yang paling belakang
# argument list (*) <<< hanya bisa 1 tidak bisa def jumlahkan( x , *list_angka, *lis... | true |