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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3ad3a6eaee13ae98521271dbb3f419fce939f8a2 | Python | michalbal/Cluedo-solver-using-Planning-and-Bayesian-Networks | /search.py | UTF-8 | 3,907 | 3.53125 | 4 | [] | no_license | """
In search.py, you will implement generic search algorithms
"""
import util
class SearchProblem:
"""
This class outlines the structure of a search problem, but doesn't implement
any of the methods (in object-oriented terminology: an abstract class).
You do not need to change anything ... | true |
afa2cf67aefcc9ff56bc157ceffd862aa846f207 | Python | dishaa19/Searching-for-Novel-Predictive-and-Diagnostic-biomarkers-of-COVID-19 | /COVID-19 (RF).py | UTF-8 | 2,251 | 3.046875 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
# In[2]:
ip = pd.read_csv("COVID-19.csv")
new_ip = ip.set_index('ID')
# In[3]:
new_ip
# In[4]:
Training = new_ip[new_ip['Dataset'] == 'Training']
Test = new_ip[new_ip['Dataset']== 'Test']
Training = Training.drop(columns=['Dataset'])
Test =... | true |
33b6cb2cbaa1f309eff618b58171ec987631473a | Python | sepear/AntColony | /evaluation.py | UTF-8 | 2,221 | 2.84375 | 3 | [] | no_license | from dataReading import readResults, readData
from problemRepresentation import SMTWTproblem
from problemSolving import generateSolution
import matplotlib.pyplot as plt
import time
N_RUNS = 4 # number of times we evaluate a problem
def generatePlot(results,benchmark, dir):
plt.clf()
plt.ylabel('best tardine... | true |
f222e038b29f14b9246b60efb8320fb64b6478fd | Python | vegarwe/blehcihost | /hci/device_interface.py | UTF-8 | 5,405 | 2.578125 | 3 | [] | no_license | import threading
import logging
import Queue
import serial
import protocol
class HciEventCallback():
def __init__(self, hcidev, classes=None, filter=None):
self.hcidev = hcidev
self.log = hcidev.log
if isinstance(classes, (list, tuple)):
self._classes = classes
elif cla... | true |
3d9c04ac5b1fd2f4cbf4fa7151a72009997931e8 | Python | seanmanson/euler | /19.py | UTF-8 | 891 | 3.625 | 4 | [
"MIT"
] | permissive | import math
daysInMonthLeap = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def isLeapYear(year):
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
curYear = 1901
curMonth = 1
curDay = 1
curWeekday = 2 #tuesday
numSundaysOnFirst = 0
w... | true |
18820557e3600e01994605b805b19c0918128dda | Python | zhouzi9412/Python-Crash-Course | /第五章/5-11.py | UTF-8 | 218 | 3.828125 | 4 | [] | no_license | numbers = list(range(1,10))
for number in numbers:
if number < 2:
print("1st")
elif number < 3:
print("2nd")
elif number < 4:
print("3rd")
else:
print(str(number) + "th") | true |
6b5e2dd5f2e59616ce6370a752f4351b2a1c406d | Python | mzfr/Competitive-coding | /Arrays/move-zero-end-of-array/case1.py | UTF-8 | 185 | 3.328125 | 3 | [] | no_license | arr = [2, 8, 7, 0, 0, 3, 6, 0, 0, 1]
c = 0
n = len(arr)
for i in range(n):
if arr[i] != 0:
arr[c] = arr[i]
c += 1
while(c < n):
arr[c] = 0
c += 1
print(arr)
| true |
48e33f6c1604366e49e35df599d6bf94917f03ef | Python | LaLuneDeIdees/EducationalProgrammingLanguages | /ver6.0.1/test/tempCodeRunnerFile.py | UTF-8 | 115 | 2.640625 | 3 | [] | no_license |
# pp = pp[2]
# for l in range(16,len(pp),16):
# list(map(lambda x: print(x,end=','),pp[l-16:l]))
# print() | true |
1bcffbaad51d78d9f9d188b5173062e2be64aa6c | Python | TakuroKato/AtCoder | /abc071_A.py | UTF-8 | 155 | 3.234375 | 3 | [] | no_license | #! -*- coding:utf-8 -*-
x,a,b = map(int,input().split())
import math
if(math.copysign(x-a,0) < math.copysign(x-b,0)):
print('A')
else:
print('B')
| true |
56d79f0169895ad4fc21091583e29ed92fcdce25 | Python | EthanHolleman/Bomb-Buster | /wires.py | UTF-8 | 1,769 | 3.328125 | 3 | [] | no_license | #problem with black or blue wires
def solveWires(wireString):
wires = wireOrder.lower().split(" ")
length = len(wireOrder)
if length == 3:
if "r" not in wires:
return "Cut the second wire"
elif wires[-1] == "w":
return "Cut the last wire"
elif wires.count("b... | true |
94bd6d5cd15f939e0faa62ebe99fd44b16bba90b | Python | gagandeep7717/ud120-intro-to-machine-learning | /final_project/poi_id.py | UTF-8 | 8,361 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python
import sys
import pickle
from math import isnan
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
from tester import test_classifier, dump_classifier_and_data
### Task 1: Select what features you'll use.
### features_list is a list of strings, each of which i... | true |
63932461173458fb4587fbdfa0407fa8bc57351b | Python | openlab-aux/klauskleber | /klauskleber.py | UTF-8 | 4,726 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
import qrcode
from io import BytesIO
import sys
from urllib.parse import urljoin
#SOH = "\x0H"
STX = "\x02"
CR = "\x0D"
ESC = "\x1B"
# 191100001800020OpenLab Augsburg
# |||||||||||||||_ text
# ||||||||||||||_ x coord
# ||||||||||_ y coord
# ||||||_ fixed
# |||_ fixed
# |_ font
class L... | true |
cd0a5a7dcdbb37901b429b3cef9cf35ac2b70876 | Python | aaadlane/githubactiontest | /average_word_length.py | UTF-8 | 144 | 3.25 | 3 | [] | no_license | def average_word_length(string):
words = string.split()
average_length = sum(len(word) for word in words) / len(words)
return average_length
| true |
bb443d95eaf469b163ebc8a328f456aeabdd6e0a | Python | ClubShooter2/c-111 | /class.py | UTF-8 | 3,019 | 3.203125 | 3 | [] | no_license | import csv
import pandas as pd
import plotly.figure_factory as ff
import statistics
import random
import plotly.graph_objects as go
df = pd.read_csv("data.csv")
data = df["Math_score"].tolist()
#fig = ff.create_distplot([data],["Math_score"],show_hist=False)
#fig.show()
mean = statistics.mean(data)
print(... | true |
8c887f070bbe1c190e0c28c93b2c1d0592594e72 | Python | sharadbhat/ClickbaitDetector | /backend/source/preprocessor/preprocess_embeddings.py | UTF-8 | 935 | 2.859375 | 3 | [
"MIT"
] | permissive | import numpy as np
from sklearn.decomposition import PCA
def preprocess_embeddings(embedding_dimension, vocabulary):
embeddings = {}
with open("models/glove.6B.50d.txt") as glove_file:
for line in glove_file:
start = line.find(" ")
word = line[:start]
embeddings[wo... | true |
ac837d17dd56e01f53240408ecf04958e299ef68 | Python | Park-Dasol/SWEA-GITHUB | /D1/2063.py | UTF-8 | 216 | 3.046875 | 3 | [] | no_license | N = int(input())
lst = list(map(int, input().split()))
for i in range(N-1, 0, -1):
for j in range(0, i):
if lst[j] > lst[j+1]:
lst[j], lst[j+1] = lst[j+1], lst[j]
med = N // 2
print(lst[med]) | true |
1fb2348c93f5e28bf38aca5745a4437b20ecb4c6 | Python | prazp/Deep-Learning-PAD | /other_code/data_creation.py | UTF-8 | 1,702 | 2.734375 | 3 | [] | no_license | #!/usr/bin/python3
import os
import math
import numpy as np
import matplotlib.pyplot as plt
import pickle
import resource, sys
fs = 16000
sin_files_genuine = []
DATADIR = "/mnt/c/Users/prasa/code/Thesis"
print("genuine creation")
gain_bin = np.linspace(1, 5, 9)
offset_bin = [-1, 0, 1]
phase_bin... | true |
067a285e389cde5660fbef513fb9321dc0e3faac | Python | Gyanesh-Mahto/Edureka-Python | /Class_Codes_Module_3&4/P5_Scope_of_a_variable.py | UTF-8 | 479 | 4.375 | 4 | [] | no_license | #Scope of a Variable:
#Global Varables:
'''
The variables which are declared out of the function and can be accessed anywhere in the program
are called as Global Variables.
'''
#Local Variables:
'''
The variables which are declared inside of the function and can be accessed only inside the function
are called as Local ... | true |
03e46e2418efc9f6e4603f2e97a28cf54743ec20 | Python | TUMH0404/kinematicstraining | /Sample/example.py | UTF-8 | 1,003 | 2.546875 | 3 | [] | no_license | # coding: utf-8
import common
import numpy as np
# jupyter notebookを使う人はコメントアウトする
#%matplotlib inline
## ここで,ファイル名を指定する。
name = ["20180302_8.csv","20180302_8.csv"]
ff = ["open","close"]
def COP(fname,figname):
datcop=common.Text2Numpy(filename=fname)
r = common.FFT_cop(freq=120,df=datcop["cop"],start=100,end... | true |
ed072686ec166c534ef1cc1df298e508ac392d8d | Python | isaacDiazP/test | /file1.py | UTF-8 | 108 | 3.640625 | 4 | [] | no_license | x = 0
if x == 0:
print("x es 0")
elif x< 0:
print("x es negativo")
else:
print("x es positivo")
| true |
e6a0986c2bc5617a15e18d9e393718a6cc0d1fe8 | Python | sdbit04/MySitePOM | /venv/Include/PositionalParam/positionalParam1.py | UTF-8 | 354 | 3.359375 | 3 | [] | no_license | var=10
def parentM():
global var
print("parentM local value of var = " + str(var))
var = 6
if 5 == 5:
var=2
print("It takes value of var from enclosed block = " + str(var))
print ("value of global var before method execution = " + str(var))
parentM()
print ("value of global var after ... | true |
a402672df87a9ea32932c957ba58308a8f93f6af | Python | 0giru/python_practice | /CoffeeMachineProject/Main.py | UTF-8 | 5,675 | 3.203125 | 3 | [] | no_license | MENU = {
"espresso": {
"ingredients": {
"water": 50,
"coffee": 18,
},
"cost": 1.5,
},
"latte": {
"ingredients": {
"water": 200,
"milk": 150,
"coffee": 24,
},
"cost": 2.5,
},
"cappuccino": {
... | true |
259d8f06e6c782e1b0f7a35723dec87741ecf78c | Python | piddnad/pixare | /pixare/models/like.py | UTF-8 | 1,205 | 2.578125 | 3 | [] | no_license | from django.db import models
from django.contrib.auth.models import User
class Like(models.Model):
"""
喜欢的数据模型
"""
photo_id = models.IntegerField()
user = models.ForeignKey(User, related_name='user', on_delete=models.CASCADE,)
photo_owner = models.ForeignKey(User, related_name='like_photo_own... | true |
10d5591e8eca76a9ab6836553f3907e1c7b13510 | Python | procrastinatorT1000/costs_manager | /purchase_parser.py | UTF-8 | 1,968 | 3.046875 | 3 | [] | no_license | import re
from datetime import datetime
import table_writer
data = "t=20180806T122000&s=240.00&fn=8712000100040824&i=16588&fp=3931869026&n=1"
processed_check_info_list = []
def is_unique_data(data):
if data in processed_check_info_list:
print('Data: [%s] already processed' %data)
return False
else:
... | true |
dc25e32e97d834a211bb3cfb8d80c38e20fb002e | Python | abhinavmodugula/NG_AI_Challenge | /main.py | UTF-8 | 8,370 | 2.75 | 3 | [] | no_license | import datetime
import cv2
import mediapipe as mp
import time
from shapely.geometry import Point
from shapely.geometry.polygon import Polygon
"""
Code created for the Northrup Grumman AI Challenge
Team 6
Simon C., Abhinav M., Sameer H.
This code runs the live simulator where the webcam
input from any device can be u... | true |
4139406b64f286362aadb6b9ed7b44bb3efc48b0 | Python | Gan-Jiang/util | /basic implementations/bit_manipulation.py | UTF-8 | 1,423 | 3.90625 | 4 | [] | no_license | '''
Some basic bit operations.
'''
def set_bit(n, i):
'''
set / turn on the ith bit
:param n:
:param i:
:return:
'''
return n | (1 << i)
def check_bit(n, i):
'''
check if the ith bit is on
:param n: the number we want to check
:param i: the bit
:return:
... | true |
fe34dae905715774a97bad71118122f906b4a1a5 | Python | philippbayer/EcologyMaps | /data/suffGradient.py | UTF-8 | 1,849 | 3.625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/python
""" parses data from sys.argv[1], builds a red-to-green colorgradient based on numerical values """
""" Is written specifically for areadata.csv """
import sys
def is_number(n):
""" Checks whether a given String is a number """
try:
float(n)
return True
except ValueError:
return False
# pa... | true |
65618d178658c8f90e28ca99fd01e8e4768929fb | Python | yenbohuang/online-contest-python | /test_template.py | UTF-8 | 475 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | #
import unittest
class Solution(object):
def testMethod(self, value):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
return value
class TestSolution(unittest.TestCase):
def setUp(self):
self.solution = Solution()
def tearDown... | true |
3cf4bb282f5c424240359e20a05e4637e252579f | Python | palladine/edu_python | /list_unique.py | UTF-8 | 382 | 3.046875 | 3 | [] | no_license | def non_unique(data):
L = []
for x in data:
if isinstance(x,str):
L.append(x.upper())
else:
L.append(x)
return [x for x in data if L.count(L[data.index(x)]) > 1]
a = non_unique(['P', 7, 'j', 'A', 'P', 'N', 'Z', 'i',
'A', 'X', 'j', 'L', 'y', ... | true |
749c3c58cd00e173859c6186809d973b83884891 | Python | 278Mt/cotohappy | /examples/example_coreference.py | UTF-8 | 575 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3.8
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 20 12:00:00 2019
COTOHA API for Python3.8
@author: Nicolas Toba Nozomi
@id: 278mt
"""
import cotohappy
if __name__ == '__main__':
coy = cotohappy.API()
document = '太郎は友人です。彼は焼き肉を食べた。'
kuzure = False
do_segment = ... | true |
d4810d4ca8e0701d9db41648c4d4f02769a6b9dd | Python | alextanhongpin/project-euler | /python/21-amicable-numbers.py | UTF-8 | 783 | 4.0625 | 4 | [] | no_license | """
Problem 21: Amicable numbers
"""
def amicable_number (n):
count = 0
for i in range(1, n):
if n % i == 0:
count += i
return count
def main():
amicable_numbers = set()
for i in range(1, 10000):
n = i
o = amicable_number(n)
if amicable_number(o) == n and n !=... | true |
b314c18fb27067fae6940a0b77ba4828df93784e | Python | manraz/aws_bro | /getLst.py | UTF-8 | 1,604 | 2.59375 | 3 | [] | no_license | '''
Author: Manu Babanu
Date: 09/04/2018
Description: Script to parse bro IDS log files. Takes log fields and fields
data from logs into list for use in application.
'''
import datetime
import pygeoip
import urllib.request
# function to parse all fields from log file into lists
def getNestLst(path):
file = open(... | true |
5720267d0f1caba1cfcdd8cf0b2b9cc730f902c3 | Python | KongBaiVso/Scrap-Bilibili-bullet-screen-of-Dasima | /get_all_danmu_and_writein.py | UTF-8 | 3,475 | 2.796875 | 3 | [] | no_license | import requests
import re
from lxml import etree
import datetime
import pandas as pd
import time
import selenium.webdriver
# Selenium打开视频作者个人网页,并获取页面HTML
driver = selenium.webdriver.Chrome()
driver.get("https://space.bilibili.com/451618887/video?tid=0&keyword=&order=pubdate")
time.sleep(2)
response = driver.page_sour... | true |
f9a82ce3d318b3959dcd7a1fff1baa0ae437526c | Python | mersted/python | /random/baseball.py | UTF-8 | 4,419 | 3.328125 | 3 | [] | no_license | # Calculates statistics of baseball player
# by inputting stats for each game
def main():
num_games = integer_check("How many games?")
tot_hits = 0
tot_plate_apps = 0
tot_walks = 0
tot_tb = 0
tot_runs = 0
tot_rbi = 0
tot_sb = 0
tot_hr = 0
tot_tr = 0
tot_do = 0
to... | true |
379d77858ea7b031d773b61d9884b16e40baf03e | Python | adswati15/RSI-Stock-Screener | /RSI StockScreener.py | UTF-8 | 2,784 | 2.78125 | 3 | [] | no_license | # define parametetrs here
candle_width = "5m"
adx_limit = 20
rsi_limit = 40
stock_price_limit = 20
step_5_flag = 0
rsi_type = "rsi_6"
import pandas as pd
import yfinance as yf
import datetime
from stockstats import StockDataFrame
# stocklist = ['MTSL', 'LPCN', 'CLRB', 'TMQ']
#stocklist = ['MIST' ,... | true |
830aa3db07190b2c52a17142c6cbd628bf68f26f | Python | mihokrusic/adventOfCode2020 | /tests/test01.py | UTF-8 | 1,042 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
import unittest
import os
os.sys.path.insert(0, os.getcwd())
from solutions import day01
from utility import inputs
class Part1(unittest.TestCase):
def test_01(self):
input = inputs.read("input01")
num_input = [int(el) for el in input]
result = day01.part1(num_input... | true |
4c0ef49909de5b4d4fa81b933892dde8f31c6451 | Python | griefrelayer/django-simple-guestbook | /main/templatetags/extra_tags.py | UTF-8 | 1,159 | 2.75 | 3 | [] | no_license | from django import template
from datetime import datetime
register = template.Library()
@register.simple_tag
def url_replace(request, field, value):
dict_ = request.GET.copy()
dict_[field] = value
return dict_.urlencode()
@register.filter(name='range')
def get_range(start, end):
try:
return... | true |
00e236b3ff6a7cb0dd099f852b2890e390662de3 | Python | 1vladal1/Lottery_ideas | /Lottery_Keno/ver_0.2/ualottery.py | UTF-8 | 17,915 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
import collections
import itertools
"""Класс LotteryFilter:
start -- с какого тиража начинать
stop -- каким тиражом заканчивать
template -- по каким лототронам и наборам шаров фильтровать тиражи
"""
class LotteryFilter(object):
__UP = "UP"
... | true |
680a39503c4c81add3bb11975be49a56397873c0 | Python | MidnightJava/adventOfCode | /AocPython/src/myAoc/2015/Day22.py | UTF-8 | 6,176 | 2.953125 | 3 | [] | no_license | '''
Created on Dec 22, 2015
@author: maleone
'''
from collections import namedtuple
import random
from _collections import defaultdict
import copy
Spell = namedtuple('Spell', 'cost damage heal armor recharge duration ')
spells = []
wins = []
winh = defaultdict(int)
spells.append(Spell(53, 4, 0, 0, 0, 0))
spells.appen... | true |
01aa35790ba041010701dbab7dfa1a3b301dfd24 | Python | anubhav9199/funcode | /star_pattern.py | UTF-8 | 568 | 3.84375 | 4 | [] | no_license | import turtle
def star(turtle, size):
col = ('red', 'yellow', 'green', 'blue', 'white')
if size <= 10:
return
else:
turtle.begin_fill()
for i in range(5):
turtle.color(col[i])
turtle.forward(size)
star(turtle, size//3)
turtle.left(216... | true |
9763e1a951a7fcb74f7c3689b61b687eb991b847 | Python | donnex/pynotifikationnu | /notifikation_nu.py | UTF-8 | 1,322 | 2.796875 | 3 | [] | no_license | import urllib
try:
import json
except ImportError:
import simplejson as json
class NotifikationNuApiError(Exception):
pass
class NotifikationNu(object):
"""A library that provides a python interface to the
Notifikation.nu API
"""
def __init__(self, api_key):
self.api_key = api_key... | true |
8ad81baae31bbfa3566e9599d7833c8230626117 | Python | mkukar/RaspiRadio | /Programming/writelcd.py | UTF-8 | 1,245 | 3.25 | 3 | [] | no_license | import sys, serial, time
global serialport
LCD = serial.Serial('/dev/ttyAMA0', 9600)
LCD.open()
#Clears the display
LCD.write('\xFE\x01')
#Checks if there are two line arguments, or else it displays nothing
if len(sys.argv) != 3:
LCD.close()
else:
#First line
LCD.write('\xFE\x80')
#checks length, if longer tha... | true |
7215fb03fa76ea7673960db5f6ac89a3b3775bd0 | Python | k1nk33/django_test | /src/newsletters/views.py | UTF-8 | 2,940 | 2.75 | 3 | [] | no_license | # Import from settings.py for send_mail
from django.conf import settings
from django.core.mail import send_mail
from django.shortcuts import render
from .forms import SignUpForm, ContactForm
# # Create your views here.
def home(request):
# Display the user initiating the request
# print "User is %s" % request... | true |
93d12f015c8ea5f9a9c8f80d7efa18455e22a218 | Python | englhardt/adventofcode2019 | /11/solve.py | UTF-8 | 3,069 | 2.859375 | 3 | [
"MIT"
] | permissive | import itertools
import operator
from queue import SimpleQueue
class VM():
def __init__(self, d, start_color=None):
self.d = d.copy()
self.d += [0] * 10000
self.i = 0
self.base = 0
self.io = SimpleQueue()
self.pos = [0, 0]
self.dir = 0
self.dir_v = [(... | true |
53e9495abd53f11c3ec7636f3d7f25619149a730 | Python | voidlessVoid/advent_of_code_2019 | /day_05/mischa/day05.py | UTF-8 | 1,854 | 2.984375 | 3 | [] | no_license | data = open('day05_input.txt')
lines = data.readline().split(',')
lines1 = [int(x.strip()) for x in lines]
def get_opcode_mode(i):
instr = str(i).zfill(5)
op_code = instr[-2:]
par1,par2,par3 = instr[-3],instr[-4],instr[-5]
return op_code, par1,par2,par3
def get_par(copy_l, op, mode,count,par_num):
... | true |
c8cc7bcaee1871e7c3e5697be9758fb3b2c344eb | Python | SeoWeon-Kyung/Python-Seminar | /seaborn_tutorial.py | UTF-8 | 2,177 | 2.703125 | 3 | [] | no_license | # %%
import os
import re
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
print("Seaborn version : ", sns.__version__)
sns.set()
sns.set_style('darkgrid')
penguins = sns.load_dataset('penguins')
#sns.histplot(data=penguins, x="flipper_length_mm", hue="species", multiple="s... | true |
3dfcb6d9bd0988ed19d2520346e875ab7a5cdd6a | Python | jisheng1997/pythontest | /main/number.py | UTF-8 | 2,152 | 4.15625 | 4 | [] | no_license | #!/usr/bin/python3
# -*- encoding: utf-8 -*-
"""
@File : number.py
@Time : 2020/8/4 14:14
@Author : jisheng
"""
import math
import cmath
import random
#变量表
var1 = -1
var2 = 4.4
var3 = 3
list1 = [1,2,3,4,5,6]
print('--------------以下是数字函数----------------')
#返回数字的绝对值 fabs(x)为绝对值的浮点数
print(abs(var1))
#返回数字的上入整数
p... | true |
2b25f13530f968eabec9c1c2a2ca52bc348f0945 | Python | spudjo/Monster_Raising_Simulator | /creature_files/creatures/formless/_template.py | UTF-8 | 1,699 | 3.15625 | 3 | [] | no_license | from creature_files.body_types.Body_Formless import Body_Formless as Formless
import configparser
class Template:
def __init__(self, name, World):
self.config = configparser.ConfigParser()
self.config.read('creature_files/creatures_config/formless/' + self.__class__.__name__ + '.ini')
co... | true |
d8d5738586e27b96919e0ab53e07552b1347e5f5 | Python | fengges/leetcode | /301-350/301. 删除无效的括号.py | UTF-8 | 1,432 | 3.265625 | 3 | [] | no_license | class Solution:
def removeInvalidParentheses(self, s):
def isValid(s):
count = 0
for char in s:
if char == '(':
count += 1
if char == ')':
count -= 1
if count < 0:
return Fals... | true |
531837b4160b31528f221a14f36f8c438e696c50 | Python | francisBae/boj-algorithm-study | /9400~9499/9461.py | UTF-8 | 217 | 2.921875 | 3 | [] | no_license | #파도반 수열
import sys
rd = lambda : int(sys.stdin.readline())
P = [0]*101
P[1] = 1
P[2] = 1
P[3] = 1
for i in range(4,101):
P[i] = P[i-2]+P[i-3]
T = rd()
for _ in range(T):
N = rd()
print(P[N]) | true |
c704e919cafdbab86649741f3804fa292c9b75f0 | Python | RachitBhargava99/SoundScape-Frontend | /frontend/models.py | UTF-8 | 573 | 2.5625 | 3 | [] | no_license | from frontend import db, login_manager
from flask_login import UserMixin
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer)
name = db.Column(db.String(127... | true |
c92e659350d39c5094a5b63a22c05583cbc5639d | Python | wudi024/testgit | /readDocx.py | UTF-8 | 2,760 | 2.640625 | 3 | [] | no_license | import os,re,sys
import win32com
from win32com.client import Dispatch, constants
from docx import Document
def parse_docx(file):
d = Document(file)
paras = d.paragraphs#段落
tables = d.tables#表格
print (file+'\t共有'+str(len(paras))+'个段落')
print (file+'\t共有'+str(len(tables))+'个表格')
try:
f ... | true |
42f8e6b3ce66452477bf9937870833fc7908534a | Python | aleneus/pvo | /design-patterns/python/composite/form.py | UTF-8 | 2,077 | 3.5625 | 4 | [] | no_license | """Composite pattern. Imitation of some GUI."""
class Component:
""" Abstract component. """
def __init__(self, caption=""):
self.caption = caption
def show(self):
raise NotImplementedError
class Button(Component):
def show(self):
print("[{}]".format(self.caption))
class L... | true |
f3dee292319cd17eb9f249f241c890fd5882d4b5 | Python | kekeho/NNCT3J-Training | /C/script/1.py | UTF-8 | 567 | 3.484375 | 3 | [
"MIT"
] | permissive | import subprocess
from time import sleep
def main():
result = [] #平均値を格納するリスト
for i in range(0, 100): # 100回ループ
output = subprocess.getoutput('./a.out') # プログラム実行
result.append(output[-1]) # 実行プログラムの出力の一番最後の文字が平均値である
sleep(1) # seed値に時間を使っているので1秒待つ
for i in range(0, 6):
... | true |
4a5a12e1f098f6ecc064af5840c5c52427ccb3ed | Python | alpha-kwhn/Baekjun | /GONASOO/11576.py | UTF-8 | 364 | 2.8125 | 3 | [] | no_license | A, B = map(int, input().split())
N = int(input())
_A = list(map(int, input().split()))
_A.reverse()
_B = []
k = r = 0
for i in range(len(_A)):
k += _A[i] * (A ** i)
for i in range(21):
if k % B**i == k:
r = i
break
for i in range(r-1, -1, -1):
_B.append(k // B ** i)
k %= ... | true |
e4bc8e2dd0e0dd7ba81fa086107a43714c8aac87 | Python | Lucas-Froguel/Simple-Regression | /Non Linear Regression for Polynomials.py | UTF-8 | 4,539 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 16 13:21:24 2021
@author: Lucas
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import legendre
def points(n, e=0.1, a=-1, b=1, poly=legendre(3)):
x = (b-a)*np.random.rand(n) - (b-a)/2
y = np.zeros(len(x))
for ... | true |
233be4a75ea587424a3fdb16f9a9258b30ce01ab | Python | wensiso/django-singleton-model | /example/example/tests.py | UTF-8 | 747 | 2.828125 | 3 | [
"MIT"
] | permissive | from django.test import TestCase
from .models import ConcreteSingleModel
class TestSingleModel(TestCase):
def test_first_instance(self):
ConcreteSingleModel.objects.create()
ConcreteSingleModel.objects.all().delete()
new_object = ConcreteSingleModel.objects.create()
self.assertEq... | true |
1d7a2644cb38c600d005849799ca22a3f15de07a | Python | dennisgilliam/django-ember-example | /djangoapp/visits/models.py | UTF-8 | 549 | 2.515625 | 3 | [] | no_license | from django.db import models
class Customer(models.Model):
name = models.CharField(max_length=30)
dateNextVisit = models.CharField(max_length=30)
typeNextVisit = models.CharField(max_length=30)
def __unicode__(self):
return self.name
class VisitLog(models.Model):
visitDate = models.Cha... | true |
b090a816054626ecb6f6b3bfcc57171ee0387cb4 | Python | SaiSujithReddy/CodePython | /table_join_with_max_values.py | UTF-8 | 1,114 | 3.21875 | 3 | [] | no_license | import operator
table1 = (('L',15),('I',12),('H',14),('J',1),('C',9),('X',4),('N',11))
table2 = (('B',13),('O',23),('H',56),('V',777),('B',171),('X',43),('N',65))
def table_join_with_max_values(table1,table2):
dict_1 = {}
dict_2 = {}
dict_3 = {}
output_list_tuples = []
for x in table1:
d... | true |
0e2b66b5fce72a6ec3319f845039d2bdbbe0b0b5 | Python | reppertj/algorithms | /union_find/union_find.py | UTF-8 | 3,231 | 3.796875 | 4 | [
"MIT"
] | permissive | """
Dynamic connectivity algorithms:
Given a set of n objects,
union command: connect two objects
find query: is there a path connecting the two objects?
These algorithms are more efficient than pathfinding algorithms because they
do not need to preserve the path,
only the fact that there is one. 'is connected to' is... | true |
6f332b45de1cd1d8c9cadaf8706d164d4fe7095b | Python | PPL-IIITA/ppl-assignment-newage-newton | /submission1/gift_luxury.py | UTF-8 | 663 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python3
"""Module containing class for luxury gits."""
class GiftLuxury(object):
"""Class for luxury gifts.
Methods:
__init__ : Initialize gifts.
"""
def __init__(self, gift):
"""Method to initialize luxury gift.
Arguments:
gift : Dictionary from i... | true |
febb81f8aa9e16968468ce331a57da6ba6fd400c | Python | alanrods/Lenguajes | /Programa5/lenguaje_test.py | UTF-8 | 1,739 | 4.3125 | 4 | [] | no_license | "Calular expresiones booleans"
def bool_Oper(equation, dic):
"""
Cambiamos cada uno de los elementos operadorees 'formales' a argumentos con las que pueda trabajar python
iterando sobre un diccionario para identificar que operando se va cambiar.
"""
for i, j in dic.items():
equation = equa... | true |
b61e2cb19750c89a63d799d220659c5345a1c471 | Python | nambelaas/Operasi-Number-Studycle | /number.py | UTF-8 | 419 | 3.859375 | 4 | [] | no_license | import numpy
arr_num = []
n = int(input("Masukkan jumlah elemen: "))
for i in range(0, n):
ele = int(input())
arr_num.append(ele)
print(arr_num)
print("\n")
s_num = sorted(arr_num)
print("Diurutkan menjadi: ")
print(s_num)
print("\n")
print("Median dari array diatas: ")
m_num = numpy.mean(s_num)
print(m... | true |
fcd4f8f762ab0f3af38f5c94ab200df5879bbfba | Python | Sanardi/bored | /PortScanner.py | UTF-8 | 2,133 | 3.296875 | 3 | [
"MIT"
] | permissive | # Thank you so much MR. GUS KHAWAJA for teaching me how to do this.
import argparse
from socket import *
# Usage python3 PortScanner.py - a 192.168.0.1 -p 21,80,8080,8081,8443
def printBanner(connSock, tgtPort):
try:
# Send data to target
if tgtPort == 80:
connSock.send("GET HTTP/1.1 ... | true |
e7bd6f1db5151289da2e5940bad1e53687dcb6bf | Python | riffAt2013/PythonPracs | /PythonBasics/filewriting.py | UTF-8 | 330 | 3.640625 | 4 | [] | no_license | def get_user(**user):
return user
name = input("Whats your name: ")
age = input("Whats your age: ")
mobile_number = input("Enter your personal number: ")
user1 = get_user(name = name, age = age, phone = mobile_number)
for index,values in enumerate(user1.keys()):
print("Info {} -->{}".format(index,user1[va... | true |
0578fd3ac14d28c549433733371d20417ec3b455 | Python | CodeForGreenLO8/stacja-badawcza | /sensors/filehandler.py | UTF-8 | 668 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python3
# ABOUT THIS MODULE
# This module provides a few basic methods for interacting with files.
# It is used by numerous other scripts and modules.
import os
def file_exists(path):
try:
f = open(path)
f.close()
return True
except FileNotFoundError:
return Fal... | true |
a7115604c5c1b1ab9ba5a11533e82c82e64273c2 | Python | binariusO1/Programming-Challenges-v3.0 | /034 - SnakeGame (python 3.7)/snake.py | UTF-8 | 5,032 | 3.15625 | 3 | [] | no_license | # programming challenge
# Snake game
# Python 3.7
# binariusO1
# import only system from os
from os import system, name
# import sleep to show output for some time period
from time import sleep
import keyboard # using module keyboard
import random # for random
import sys # for esc->exit
# defin... | true |
ff894845e9b29f32652dc042f69487955bcb90a3 | Python | asmuelle/UdemyTF | /Chapter2_Python/Logic.py | UTF-8 | 312 | 3.15625 | 3 | [
"MIT"
] | permissive | #### Abfragen und Logik in Python ####
bin_ich_pleite = None
bin_ich_reich = None
kontostand = 0
if kontostand > 0:
bin_ich_pleite = False
elif kontostand == 0:
print("Mies gelaufen.")
bin_ich_pleite = True
else:
bin_ich_pleite = True
print("Bin ich pleite?", bin_ich_pleite)
| true |
8763ed44087848441af0e5621c0125502014ab30 | Python | Julian21A/Python-HackerRank-Challenges-Medium | /Triangle Quest.py | UTF-8 | 79 | 3.109375 | 3 | [] | no_license | for i in range(1,int(input())):
if i>=1 and i<=9:print(int(i * 10**i / 9))
| true |
a625fddd8405544554fec10cf709dc3500ce2d12 | Python | alex-akn/traceroute-visualization | /vis_route.py | UTF-8 | 2,929 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
import urllib.request
import json
import os, sys
import re
import getopt
import subprocess
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
# from gcmap import GCMapper
# gcm = GCMapper()
def getLoc(IP):
"Turn a string representing an IP address into a lat long pair"
#Other ... | true |
bf2ff6c76e598acf8b57b2424e0160147eef470a | Python | SMY99/kpk_180921 | /gadget.py | UTF-8 | 1,229 | 2.875 | 3 | [] | no_license | class Smartphone:
def __init__(self, name, characteristic, price):
self.name = name
self.characteristic = characteristic
self.price = price
def __str__(self):
return f'смартфон: {self.name}, {self.characteristic}, {self.price} руб.'
@classmethod
def import_from_file(cls... | true |
516e38a2295a71947294aa2eaf7cfcc6dace9104 | Python | RohanLodhi/pyprograms-filehandling | /readlines.py | UTF-8 | 129 | 3.15625 | 3 | [] | no_license | with open("test.txt", "r") as f:
##Small Files:
f_contents = f.readlines() #return list
print(f_contents)
print(f.closed)
| true |
911a7952de46a246c2ca80a34846091f9e3359a3 | Python | alsohas/CS455 | /tcss455group7/likes_gender_classifier.py | UTF-8 | 2,030 | 2.640625 | 3 | [] | no_license | import codecs
import os
import pickle
from os.path import basename, exists, join, splitext
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
class likes_gender_classifier:
def __init__(self):
'''empty constructor'''
def __get_model(self):
# fil... | true |
3b4f5e241db852d36557d2c9f9bdadfe0635ed7f | Python | prrn-pg/Shojin | /templates/Typical/Math/nCrAll.py | UTF-8 | 609 | 3.265625 | 3 | [] | no_license | def nCr(i, cur, rest, target):
if rest == 0:
yield cur
elif len(target) - i == rest:
# 今回のやつを取るしかない
nex = cur[:]
nex.append(target[i])
for ncr in nCr(i+1, nex, rest-1, target):
yield ncr
else:
# 含めるか含めないか
nex = cur[:]
ne... | true |
900ee9b30f1c1e5a15e81847bb0880f88fdc5c32 | Python | tangerine122/Spider | /juejin.py | UTF-8 | 1,101 | 2.875 | 3 | [] | no_license | """
@author:Adam
@time:2018-10-15 20:10
@desc:掘金小册抓取
"""
import requests
import json
for page in range(1, 3):
url = "https://xiaoce-timeline-api-ms.juejin.im/v1/getListByLastTime?uid=&client_id=&token=&src=web&alias=&pageNum={}".format(page)
header = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; ... | true |
db47c6c6187c99bdd6ad15236d2cbef3d6076566 | Python | microsoft/qlib | /qlib/contrib/model/catboost_model.py | UTF-8 | 3,778 | 2.625 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import numpy as np
import pandas as pd
from typing import Text, Union
from catboost import Pool, CatBoost
from catboost.utils import get_gpu_device_count
from ...model.base import Model
from ...data.dataset import DatasetH
from ...data.dataset.h... | true |
d78cb28bbc84535787e73d5d464393e3b4125c77 | Python | AZ-OO/Python_Tutorial_3rd_Edition | /4章 制御構造ツール/4.7.2.py | UTF-8 | 2,424 | 3.703125 | 4 | [] | no_license | """
4.7.2 キーワード引数
"""
# 関数はキーワード引数もとれる
# 『キーワード = 値』のかたち
def parrot(voltage, state = 'a stiff', action = 'voom', type = 'Norwegian Blue'):
print("This parrot wouldn't", action, end = '')
print("if you put", voltage, "volts through it.")
print(" -- Lovery plumage, the", type)
print(" -- It's", state, "!... | true |
28b33d8719309088be29950925b5169158592c27 | Python | vivekpandian08/30days_LeetCode_Challenge_June | /Day_5_Random_pick_with_Weight.py | UTF-8 | 463 | 3.25 | 3 | [] | no_license | import bisect
import random
class Solution(object):
def __init__(self, w):
"""
:type w: List[int]
"""
self.prefisSum = w
for i in range(1, len(self.prefisSum)):
self.prefisSum[i] = self.prefisSum[i] + self.prefisSum[i - 1]
def pickIndex(self):
"""
... | true |
a0ccb2ff0b43adac63f1472e50c25d9e1ebc2e7e | Python | samyuktahegde/Python | /datastructures/arrays/delete_next_smaller_element.py | UTF-8 | 547 | 3.546875 | 4 | [] | no_license | def delete_next_smaller_element(array, k):
stack = []
count = 0
for i in range(0, len(array)):
stack.append(array[i])
print(stack)
print('i', i)
for j in range(i+1, len(array)):
if len(stack)==0:
break
elif stack[-1]>array[j]:... | true |
354de2243f1f1814ed24fecd609370dd18a56df3 | Python | mhcrnl/py-editor | /py_editor/oozaar/linenumber.py | UTF-8 | 4,575 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# ---------------- READ ME ---------------------------------------------
# This Script is Created Only For Practise And Educational Purpose Only
# This Script Is Created For http://bitforestinfo.blogspot.com
# This Script is Written By
#
#
##################################################
#... | true |
8bef6c76ac744dcaf55630a87a5b538ccb693d76 | Python | Zhoroev/homework_2.5 | /h2_5_quest2.py | UTF-8 | 550 | 3.203125 | 3 | [] | no_license | import random
names = ['dhhgfjjhsa.txt', 'hhdsdahffh.txt', 'afdgdhjsds.txt',
'sggjghddss.txt', 'fjdjgdghdf.txt', 'sjssahjfga.txt',
'agsgdjhhfj.txt', 'gafadhadda.txt', 'hdagajfhhj.txt',
'fhjhafhdfa.txt']
file = open(f'{names[random.randint(0, 10)]}', 'w')
def func(argument):
for name in... | true |
507342f8824111c1b48db704bfce1e00852113e3 | Python | Sinedd231/2I013-groupe4 | /old/projet-S3/src/mainS3_objectif.py | UTF-8 | 1,337 | 3.1875 | 3 | [] | no_license | '''
@author: Alexandre
@test: Denis
'''
from fenetre import *
from robot import *
from controlleur import *
import time
from obstacle import *
from objectif import *
#on creer la fenetre
ma_fenetre=Fenetre(900,900) #a ne pas changer, ou alors reflechir a comment creer des constantes inter-fichiers
#on creer les ro... | true |
677f713215dc12f390a51b0afb6eb5d15ec22cbf | Python | dpazel/music_rep | /transformation/harmonictranscription/t_harmonic_transcription.py | UTF-8 | 9,682 | 2.75 | 3 | [
"MIT"
] | permissive | """
File: t_harmonic_transcription.py
Purpose: Given a line and its hct, and a target hct as long as the prior said given, reproduce the line
to the new target hct, based on its constraints plus those of the melodic search analysis.
"""
from melody.constraints.chordal_pitch_constraint import ChordalPitchCon... | true |
4b710a760186e3f32f3fbcf2dcb1185e03de662c | Python | morgoth1145/advent-of-code | /2019/10/solution.py | UTF-8 | 2,618 | 3.65625 | 4 | [] | no_license | import collections
import math
import lib.aoc
import lib.grid
def compute_minimum_angle(dx, dy):
if dx == 0:
if dy > 0:
return 0, 1
else:
return 0, -1
if dy == 0:
if dx > 0:
return 1, 0
else:
return -1, 0
else:
# Simpl... | true |
faa19296416e7945cfe6c71550f9d49dc650bb33 | Python | timjdavey/google-doc-sync | /spreadsheet.py | UTF-8 | 6,504 | 3.09375 | 3 | [] | no_license | import gdata.spreadsheet
import gdata.spreadsheet.service
import gdata.service
class EntryDoesNotExist(Exception):
pass
class EntryAlreadyExists(Exception):
pass
class MutipleEntriesExist(Exception):
pass
class GoogleRow(object):
"""Helper object to pass info. Please see docs for usage."""
def ... | true |
72e514094ead74ac8a63eb51d54ac8a1d5f78903 | Python | FilipKomljenovic/TetrisAgent | /pieces/opiece.py | UTF-8 | 2,126 | 2.875 | 3 | [] | no_license | from pieces.piece import Piece
class OPiece(Piece):
HEIGHT = 2
WIDTH = 2
LEFT = 1
RIGHT = 2
# add piece color and setter
def __init__(self, shape, board):
super().__init__(shape, board)
def fill_configurations(self, board):
if not len(self.configurations) == 0:
... | true |
b3d8abb37a557544d1933c5c3468a32ead1a7380 | Python | daniel-kullmann/advent-of-code | /2.py | UTF-8 | 251 | 3.109375 | 3 | [] | no_license | fh = open('2.txt', 'r')
area = 0
for line in fh.readlines():
sizes = map(int, line.strip().split('x'))
sides = [sizes[0]*sizes[1], sizes[1]*sizes[2], sizes[0]*sizes[2]]
smallestSide = min(sides)
area += smallestSide + 2*sum(sides)
print area
| true |
c93e0144366062e193efe6cb092b3e2d6bea1297 | Python | Smookii/PossibleGame | /ball.py | UTF-8 | 1,102 | 3.390625 | 3 | [] | no_license | import pygame
from pygame import Vector2
class Ball():
def __init__(self, color, startposition, width,window):
self.color = color
self.width = width
self.float_pos = Vector2(startposition)
self.position = [int(self.float_pos[0]),int(self.float_pos[1])]
self.window = windo... | true |
c9eb3b76b56be615b76adf1395fd0d45567c0988 | Python | choococo/MoMLearning | /2.opencvLearning/stage04/4. findContours.py | UTF-8 | 1,505 | 3.265625 | 3 | [] | no_license | import cv2
import numpy as np
'轮廓查找与绘制:findContours()、drawContours()'
'轮廓检索、轮廓近似'
img = cv2.imread("../images/23.jpg")
# img = cv2.imread("../images/1.jpg")
# 1. 灰度化
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# 2. 阈值二值化
ret, thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
# 3. 查找轮廓:包括的c... | true |
8180dcbc9b42d010841d0fbfa22c5c1e4ca85943 | Python | KrakSat-2016/kraksat-server | /api/tests/test_telemetry.py | UTF-8 | 1,795 | 2.53125 | 3 | [
"MIT"
] | permissive | from django.core.urlresolvers import reverse
from api.models import Telemetry
from api.tests.utils import KrakSatAPITestCase
class TelemetryTests(KrakSatAPITestCase):
"""Tests for /telemetry API endpoint"""
list_url = reverse('telemetry-list')
model = Telemetry
valid_data = {
'timestamp': Kr... | true |
0d75fc2567304415cc5c6310d6ff5bec4d47c5c8 | Python | siddharththakur26/data-science | /Core/Languages/python/HackerRank/birthdayChocolate.py | UTF-8 | 652 | 3.109375 | 3 | [] | no_license | s = [2,5,1, 3, 4, 4, 3, 5, 1, 1, 2, 1, 4, 1, 3, 3, 4, 2, 1]
d = 18
m = 7
temp=[]
cnt=0
for i in range(0,len(s)):
temp = s[i:m+i]
if len(temp) == m:
#print temp
sumValue = sum(temp)
#print sumValue
if sumValue == d:
cnt +=1
print cnt
'''
result =[... | true |
f0fad501a1f01191e2a3e742fd18708cb280a653 | Python | alfredang/tensorflow_workshop | /Module_3_0.py | UTF-8 | 2,033 | 3.328125 | 3 | [] | no_license | # Tensorflow workshop with Jan Idziak
#-------------------------------------
#
#script harvested from:
#https://github.com/nfmcclure
#
# Loss Functions
#----------------------------------
#
# This python script illustrates the different
# loss functions for regression and classification.
import matplotlib.pyplot as ... | true |
5cb583a31b1993419cb6b2ca3691609d4b74b56f | Python | Data-Designer/Leetcode-Travel | /leetcode/138.复制带随机指针的链表.py | UTF-8 | 1,210 | 3.15625 | 3 | [
"MIT"
] | permissive | '''
Description: hash表,先单纯复制然后再处理random
version:
Author: Data Designer
Date: 2021-08-30 10:13:31
LastEditors: Data Designer
LastEditTime: 2021-08-30 10:32:23
'''
#
# @lc app=leetcode.cn id=138 lang=python3
#
# [138] 复制带随机指针的链表
#
# @lc code=start
"""
# Definition for a Node.
class Node:
def __init__(self, x: int, ... | true |
5b3c5edd9d71a0dde216a3217658d265b54432a2 | Python | karlhl/Machine-Learning | /1.4RNN/RNN-classifier/RNN_classifier_gpu.py | UTF-8 | 2,278 | 2.734375 | 3 | [] | no_license | import torch
import torchvision.datasets as dsets
import torch.nn as nn
import torchvision.transforms as transforms
import os
EPOCH = 30 # train the training data n times, to save time, we just train 1 epoch
BATCH_SIZE = 64
TIME_STEP = 28 # rnn time step / image height
INPUT_SIZE = 28 #... | true |
478998af9a3aae5058a5dd0258bdd7d85a1205b8 | Python | MorgannSabatier/gpt3_gender | /code/get_entity_info.py | UTF-8 | 19,287 | 3.09375 | 3 | [] | no_license | """
Getting entities in stories
and the pronouns associated with them.
"""
import os
import csv
from collections import defaultdict, Counter
import json
import re
import numpy as np
LOGS = '/mnt/data0/lucy/gpt3_bias/logs/'
def remove_punct(s):
#regex = re.compile('[%s]' % re.escape(string.punctuation))
rege... | true |
1dea2b38e2e8581773b2e5070d170cfdf02f87a1 | Python | abhi8893/Intensive-python | /exercises/factorials.py | UTF-8 | 446 | 4.34375 | 4 | [] | no_license | # Find factorials of a list of numbers
def factorialize(numbers):
""" Return factorials of a list of numbers.
>>> factorialize([1, 2, 3, 4, 5])
>>> [1, 2, 6, 24, 120]
"""
res = list(map(fact, numbers))
return(res)
def fact(n):
if n == 0:
return(1)
else:
... | true |
c5ed6d7c52d8765028b2ba2bf1fd932a32f359b3 | Python | jimxliu/rosalind | /dict.py | UTF-8 | 227 | 3.5625 | 4 | [] | no_license | with open("dict.txt","r") as f:
s = f.readline().strip()
l = s.split(" ")
my_dict = {}
for word in l:
if word in my_dict:
my_dict[word] += 1
else:
my_dict[word] = 1
for key, value in my_dict.items():
print(key,value)
| true |
b4e2dc291d0ebc596fe74048efc0787966830b9d | Python | palunel/DemoGitRepo | /app.py | UTF-8 | 146 | 2.578125 | 3 | [] | no_license | print("This is a GitHub repository demo app.")
print("Updated on local repository")
print("Yeah we are done!")
print("THought we were done?!")
| true |
8c2e2ee33cf32e5baaaa113eef80d59c089ab801 | Python | Agungtirtayashaa/labspy02 | /lab.py | UTF-8 | 274 | 3.765625 | 4 | [] | no_license | print (" tugas praktikum 2")
a = int(input('Masukkan nilai a: '))
b = int(input('Masukkan nilai b: '))
c = int(input('Masukkan nilai c: '))
if a > b and a > c:
print('A yang terbesar')
elif b > a and b > c:
print('B yang terbesar')
else:
print('C yang terbesar')
| true |
139279959956883586757481f7a19a5f1876c58f | Python | VladOvadiuc/Python | /Student_Lab_Assignments/AssigController.py | UTF-8 | 1,965 | 2.953125 | 3 | [] | no_license | from domain import Assignment
class AssigController:
def __init__(self,assigRepo):
self.__assigRepo = assigRepo
def findID(self, ID):
'''
Search an assignment by it's id
:param ID: the id to be found
:return: true / false if the id is found or not
'''
fo... | true |