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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
530e78cfaf61329b81acdad0309247af27335469 | Python | RafidaZaman/Lab-3-solution | /Problem 4.py | UTF-8 | 367 | 2.828125 | 3 | [] | no_license | from sklearn.datasets import load_iris
from sklearn.neighbors import KNeighborsClassifier
from sklearn import metrics
iris = load_iris()
# X = features and y = response
X = iris.data
y = iris.target
print(iris)
knn = KNeighborsClassifier(n_neighbors=50)
knn.fit(X, y)
y_pred = knn.predict(X)
print("Accura... | true |
638419846c35eaf0d3885cf9bc09549afb7c2340 | Python | lic-informatica-umet/Eibu-s-code | /Uni Programacion/IntroProg/Guia de ejercicios/Unidad 7/1 - Operaciones Condicionales/3.py | UTF-8 | 671 | 4.875 | 5 | [] | no_license | '''
3. Ingresar dos valores y realizar cl producto, si el 1ro es mayor al 2do, si son iguales solo indicarlo.
'''
# Nombre: Agustin Arce
# Fecha: 20/04/2019
# Programa: Producto entre dos numeros
# Inicializacion de variables
num1 = 0
num2 = 0
prod = 0
# Ingreso de datos
num1 = float(input("Ingrese primer numero:... | true |
35d654597e5a2d9de53510654e1c617d7417bcfd | Python | a8578062/store | /Day13/homework/sendemail.py | UTF-8 | 1,602 | 2.53125 | 3 | [] | no_license | import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from email.header import Header
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import os,sys
from nt import chdir#判断目录是否存在并切换目录
print("正在发送...")
#登陆邮件服务器
smtpObj=smtplib.SMTP('smtp... | true |
79de0fb745ad4c52ac84db5ebb3ca9e3a5685d87 | Python | haruki37/keisan | /test/latexfile.py | UTF-8 | 1,818 | 2.890625 | 3 | [] | no_license | """
latexfile.py
"""
import os
import subprocess
import textwrap
class LatexFile:
PROLOGUE = textwrap.dedent('''\
\\documentclass[{}pt,dvipdfmx,a4paper]{{jsarticle}}
\\usepackage{{amsmath}}
\\usepackage{{tgpagella, euler}}
\\begin{{document}}\
''')
def __init__(self, f... | true |
b7d68915559caff7605dbf2ed2c2505261fb60c4 | Python | Bhargavisaikia219/Madlibs-Generator | /Madlibs_Generator.py | UTF-8 | 1,425 | 3.8125 | 4 | [] | no_license | #taking a series of input from the user
charname1 = input("Give me a character name:")
charname2 = input("Give me another character name:")
place = input("Give me name of a place:")
yr = input("Mention a year:")
verb1 = input("Give me a verb (present tense):")
noun1 = input("Give me a noun:")
noun2 = input("Give me ano... | true |
b8783374f1caca681dfa97860e2348055ed575e6 | Python | TheDubliner/RedArmy-Cogs | /stig/stig.py | UTF-8 | 4,873 | 2.65625 | 3 | [
"MIT"
] | permissive | from pathlib import Path
import asyncio
import discord
import random
import re
import yaml
from redbot.core import (
Config,
commands,
data_manager
)
from redbot.core.utils import (
chat_formatting
)
UNIQUE_ID = 5140937153389558
class Stig(commands.Cog):
__version__ = "0.1.0"
DATAFILENAME... | true |
01bef5c36db1d849c01f5202669baf49cf430f49 | Python | chiragjindal/Competitive-programming | /Codechef/APRIL12/DUMPLING.py | UTF-8 | 278 | 2.75 | 3 | [] | no_license | #import psyco
#psyco.full()
def gcd(a,b):
while b>0:
a,b=b,a%b
return a
for i in range(input()):
a,b,c,d,k=raw_input().split(' ')
g1,g2=gcd(int(a),int(b)),gcd(int(c),int(d))
lcm=(g1*g2)//gcd(g1,g2)
positions=int(k)//lcm
print (positions*2)+1
| true |
9f03c323c4617f000ed4e8f98be04dd18a629f35 | Python | sven91swe/CarND-AdvancedLaneLines | /code/development.py | UTF-8 | 5,871 | 2.71875 | 3 | [] | no_license | import cv2
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.image as mpimg
from undistort import undistort
from transformPerspective import transformPerspective, inverseTransformPerspective
from imageFilters import threshold, sobelX, sobelY, sobel... | true |
aa94564cc3e854f4d61fd37cb7d80d71ba5f3b00 | Python | TangYiChing/A-method-to-discover-combinatorial-variants-within-transcription-factors-associated-with-gene-expres | /script/parse_randomSelection_result.py | UTF-8 | 6,956 | 2.703125 | 3 | [] | no_license | """
Run Wilconsin Ranked Sum for each outliers that passed background models
Report outliers passing Wilconsin paired test (p<0.01)
"""
import os
import sys
import glob
import argparse
import numpy as np
import pandas as pd
import scipy.stats as scistats
def read_as_df(input_path):
"""
Function to read tab-de... | true |
d67fae4939f9f191b16c1abab7f587eccf014c75 | Python | ericzhai918/Python | /My_Python_Test/Higher_Order_Function/map_02.py | UTF-8 | 216 | 3.265625 | 3 | [] | no_license | def f(x):
return x * x
l = []
for n in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
l.append(f(n))
print(l)
r = map(f, [1, 2, 3, 4, 5, 6, 7, 8, 9])
print(list(r))
s = map(str, [1, 2, 3, 4, 5, 6, 7, 8, 9])
print(list(s))
| true |
c92f3a1ad062f2fd87a14bb5e5d42d2d2be55d63 | Python | eabdiel/python_playground | /Russian Peasant Algorithm - Multi Module Flow/sim_database.Py | UTF-8 | 938 | 3.359375 | 3 | [] | no_license | """
Simulation of Web App Architecture | Case study based on assignment from
https://www.udemy.com/share/103nlaAEMZdllWTHg=/
Run flow_controller.py to start
"""
import time
def russian(a, b):
x = a;
y = b # Semicolon -> Compound Statement
z = 0 # Acumulato... | true |
c3f103854b4b9091fb1cc17747b72dd0c1c0559d | Python | JeetShetty/Blackjack | /tests/test_round.py | UTF-8 | 9,916 | 2.625 | 3 | [] | no_license | import unittest
import mock
from blackjack import round
class TestRound(unittest.TestCase):
def setUp(self):
self.mock_time = mock.Mock()
self.mock_shoe = mock.Mock()
self.mock_bankroll = mock.Mock()
def test_deal_hands_dealer_natural(self):
mock_player_input = mock.Mock()
... | true |
69159eed6aa0e9a1b97fbfda47a9d8d5d0658cd7 | Python | 0x5eba/Dueling-DQN-SuperMarioBros | /environment/frame_stack_env.py | UTF-8 | 2,145 | 3.265625 | 3 | [
"MIT"
] | permissive | """An environment wrapper to stack observations into a tensor."""
from collections import deque
import numpy as np
import gym
class FrameStackEnv(gym.Wrapper):
"""An environment wrapper to stack observations into a tensor."""
def __init__(self, env, k):
""" Stack k last frames.
Returns la... | true |
07566fa9877faf0ed693fee24f643a38d308d6b2 | Python | chance-murphy/national-parks-website-scraper | /SI507_project4.py | UTF-8 | 4,388 | 3.09375 | 3 | [] | no_license | import requests, json
from bs4 import BeautifulSoup
from advanced_expiry_caching import Cache
import pandas as pd
import csv
# "crawling" -- generally -- going to all links from a link ... like a spiderweb
# its specific def'n varies, but this is approximately the case in all situations
# and is like what you may want... | true |
74e9391f8214ef30216a35cd7eeebc8cd191bed9 | Python | caideyang/python2018 | /Python全栈学习/第二模块 函数、装饰器、迭代器、内置方法/practise/map-test.py | UTF-8 | 119 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
#@Author:CaiDeyang
#@Time: 2018/9/6 15:57
L = [1,2,3,4,5]
l = map(lambda x:x**2,L)
print(list(l)) | true |
654ed1d6cd8c2baffb6837df0179c95a3c0a24bd | Python | scress78/Module7Try2 | /sort_and_search_list.py | UTF-8 | 652 | 3.984375 | 4 | [] | no_license | """
Program: sort_and_search_list.py
Author: Spencer Cress
Date: 06/21/2020
This program contains the functions sort_list and search_list for
Search and Sort List Assignment
"""
def sort_list(x):
"""
:parameter x: a list to be sorted
:returns: A sorted list
"""
x.sort()
retur... | true |
aff22dcaf92ac61c374a7ede56a19c8afc39cd13 | Python | murakami10/atc_python | /solved/05/abc106_b.py | UTF-8 | 575 | 2.9375 | 3 | [] | no_license | import collections
from typing import Dict
N = int(input())
ans: int = 0
for i in range(1, N + 1):
if i % 2 == 0:
continue
tmp_i: int = i
table: Dict[int, int] = collections.defaultdict(lambda: 0)
for j in range(2, int(pow(i, 0.5)) + 1):
while tmp_i % j == 0:
tmp_i //= j
... | true |
49160f697f87c3fe4c9ba55b46c0e24e35e5b99c | Python | mudkip201/distributions | /dist/src/dists/chi2.py | UTF-8 | 1,222 | 2.640625 | 3 | [] | no_license | '''
Created on Jul 15, 2017
@author: matthewcowen-green
'''
import dists.Distribution.Distribution as Distribution
import math
import dists.normal.normal as normal
class chi2(Distribution): #Chi-squared
@staticmethod
def random(k):
avg_=0
for _ in range(k):
avg_+=math.pow(normal.... | true |
e1955dd78da70ac6ea18500c927d0f117562e6f7 | Python | leoprover/ltb | /leo3ltb/data/problem.py | UTF-8 | 3,929 | 2.765625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from ..tptp.szsStatus import SZS_STATUS
class Problem:
'''
LTB Problem
* filePattern: the pattern of problem files for this problem, usally something like 'Problems/HL400001*.p', * is a placeholder
for the variant of the problem, @see ProblemVariant
* output: the name of the outfile for the pro... | true |
f94661e500810391bbc385fd65c9c3da84024cff | Python | cameronmcphail/RAPID | /rapid/robustness/analysis/comparisons.py | UTF-8 | 4,736 | 3.328125 | 3 | [
"MIT"
] | permissive | """Compares robustness values
Contains (1) a function for showing how a different set of scenarios
affects the robustness values and robustness rankings; and (2) a
function for showing how different robustness metrics affects the
robustness values and robustness rankings.
Also contains a helper function for creating ... | true |
324ed4c429db05389bc6764b4aef19248d12f492 | Python | rasake/MPCAS | /FFR135 Artificial Neural Networks/Assignment 1/pattern_utilities.py | UTF-8 | 565 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 19 13:19:57 2016
@author: Rasmus
"""
import numpy as np
def create_random_pattern(pattern_length):
temp_lst = [np.sign(2*(np.random.rand()-0.5)) for x in range(pattern_length)]
return np.reshape(np.array(temp_lst), [pattern_length, 1])
def store_random_pat... | true |
c582d85e80fe750df50762b9b11632bafea06ccd | Python | TuomoNieminen/BrewStat | /data/ratebeer_python_old/format_beer_json.py | UTF-8 | 1,055 | 3.484375 | 3 | [] | no_license | import json
# Reads a json file containting beer information, adds missing value tags to all the beers that are
# missing features so that all beers have all features. Saves the new formatted json to output file
def add_missing_value_tags(input_file: str = "first5beers.json", output_file: str ="formatted_beers.json",... | true |
e8a942c7afa534bf4de19c9e78dee3bf730f4d94 | Python | igormorgado/nlp | /writes/asd.py | UTF-8 | 758 | 2.515625 | 3 | [] | no_license | import numpy as np
S = "Será que hoje vai chover, eu não sei não"
S = S.lower()
S = S.replace(',', '')
S = S.split()
V = list(set(S))
V.sort()
V = dict(zip(V, range(0, len(V))))
n = len(V)
M = np.zeros((4,n), dtype=int)
for k, w in enumerate(S[0:2] + S[3:5]):
i = V[w]
wr = np.zeros(n)
wr[i] = 1
M[k] = ... | true |
4228b5b992f1c5bef25c7ed809deecca1a2f51d6 | Python | JuliaMaria/Algorytmy-Kombinatoryczne | /3/Ex2.py | UTF-8 | 440 | 3.296875 | 3 | [] | no_license | import numpy as np
def rank(subset, n):
result = np.repeat(0, n)
for x in range(n):
if x+1 in subset:
result[x] = 1
b = 0
r = 0
for x in range(0,n):
b = (b+result[x])%2
if b == 1:
power = n-(x+1)
r = r + np.power(2, power)
print r... | true |
2f93d29ad388fce9d51c3149bf4cb86d537b6b06 | Python | Csonic90/python_example_PL | /lista 7/zad5.py | UTF-8 | 316 | 3.34375 | 3 | [] | no_license | fo = open("p.txt", "r")
s = fo.read()
ls = list(s.split())
element = input('podaj szukane słowo')
iloscElem = ls.count(element)
if iloscElem > 0 :
print('słowo "'
+ element
+'" znajduje sie w szukanym tekscie : '
+ str(iloscElem)+' razy' )
else :
print('slowo nie występujeala')
fo.close() | true |
4f497581351344a20f972e7759843ace5f39e93d | Python | Kolbk17/cs660aia-voip-flood-detect | /sip_generator.py | UTF-8 | 5,495 | 2.609375 | 3 | [] | no_license | import random
import graph_pps
import make_sketch as ms
"""
Assigns a specific range of values within the maximum and minumum packets per second to a percent.
The percent represents the number of packets within a range of the normal distribution.
The percents used are: 0.1, 0.5, 1.7, 3.4, 8.2, 13.0, 23.1
"""
def get_d... | true |
06d5e97a8ac55f266c525989bba877831f8c48a5 | Python | Chelton-dev/ICTPRG-Python | /file10readnum.py | UTF-8 | 215 | 3.671875 | 4 | [] | no_license | infile = open('numbers2.txt')
num1 = int(infile.readline())
num2 = int(infile.readline())
num3 = int(infile.readline())
infile.close()
total = num1+num2+num3
print("numbers: ", num1,num2,num3)
print("total: ",total) | true |
ee2e020fd78a07716d0f6566181e5fee5426cf40 | Python | RuiSONG1117/SD201 | /kNN.py | UTF-8 | 3,130 | 2.984375 | 3 | [] | no_license |
# coding: utf-8
# In[178]:
import os
import sys
import random
os.chdir("/Users/songsophie/Documents/SD/SD201 DataMining/TP2/data")
import sklearn as sk
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.neighbors import KNeighborsClassifier
import numpy as np
from sklearn.feature_extraction.t... | true |
b0f1dbd50ee77ba589182a299b32b8ca1739f087 | Python | janewjy/Leetcode | /UniqueBinarySearchTrees.py | UTF-8 | 803 | 3.359375 | 3 | [] | no_license | class Solution(object):
def numTrees(self, n):
"""
:type n: int
:rtype: int
"""
subtree = {0:1, 1:1,2:2}
for i in xrange(1,n+1):
if i not in subtree:
print i
num = 0
for j in range(i):
nu... | true |
69f8f2afdc30b7b377eaf9dc2cb81154d0090048 | Python | AlaixComet/AnnotationSlamPTut | /traitement donnees/randomizeList.py | UTF-8 | 1,181 | 3.421875 | 3 | [] | no_license | from random import randint
"""
file used to generate random list of texts
"""
def randommizeList(l):
"""
with a list l return randomized list l2
"""
l2 = []
if len(l) == 0 :
raise Exception("list can't be empty")
while(len(l)>0) :
if len(l) == 1 :
l2.append(l.pop())... | true |
a9ec96f9620c5e8275f3a8a9fbb5c82f9fb20028 | Python | digitalWestie/curlybot | /curlybot.py | UTF-8 | 3,412 | 2.78125 | 3 | [
"MIT"
] | permissive | import os
import time
import json
from slackclient import SlackClient
import pycurl
from io import BytesIO
# curlybot's ID as an environment variable
BOT_ID = os.environ.get("BOT_ID")
AT_BOT = "<@" + BOT_ID + ">"
# instantiate Slack & Twilio clients
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
HOST ... | true |
63ea8b7bff029f6829f902e9843e9faa6715145d | Python | antarcticalgebra/antarcticalgebra | /play_level.py | UTF-8 | 4,933 | 3.109375 | 3 | [] | no_license | #! /usr/bin/env python
import pygame
import random
import time
from equation import Equation
class play_level:
def draw(self, level, event):
self.__screen.fill([0, 0, 0])
pygame.font.init()
font = pygame.font.Font(None, 100)
ren = font.render("This is level " + str(level), 1, [0, 25... | true |
c88c83b2f36cf02bc51971358cf2f88143dd00a4 | Python | dipalpatel77/mypythonpractice | /collagechallange.py | UTF-8 | 70 | 3.59375 | 4 | [] | no_license | a=input("enter the number")
n=0
while(a!=0):
n+=a%10
a=a/10
print n
| true |
27313219c97489391301dae072fa241336b8dfb9 | Python | SweetSnack/unipg-twitter-stream | /twitter/listeners.py | UTF-8 | 1,371 | 2.53125 | 3 | [] | no_license | import json
import config
from tweepy import OAuthHandler, API, Stream
from tweepy.streaming import StreamListener
from server import MessageHandler
class StdOutListener(StreamListener):
"""
Handles tweets from the received Twitter stream.
"""
def on_data(self, data):
data = json.loads(data)... | true |
f2b5055d146abfc7020290361e759ab7683da7d6 | Python | Bandwidth/python-sdk | /bandwidth/voice/bxml/verbs/start_stream.py | UTF-8 | 2,559 | 2.9375 | 3 | [
"MIT"
] | permissive | """
start_stream.py
Representation of Bandwidth's start stream BXML verb
@copyright Bandwidth INC
"""
from lxml import etree
from .base_verb import AbstractBxmlVerb
START_STREAM_TAG = "StartStream"
class StartStream(AbstractBxmlVerb):
def __init__(self, destination, name=None, tracks=None, streamEventUrl=No... | true |
d9b638ef42f0811466dc59195f5d89a5e6178d08 | Python | tomfisher/tradingtool | /trash/create_stock_history.py | UTF-8 | 786 | 2.765625 | 3 | [
"MIT"
] | permissive | from yahoo_finance import Share
import sys
import json
import csv
# Create the list of stock symbol s
symbols = []
with open('data/companylist.csv', 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='|')
header_skip = False
for row in reader:
symbol = row[0][1:-1]
if not header_ski... | true |
4df9b7340aa208f10b929f1e7bc8ad07da768cab | Python | gurumitts/lumens | /lumens/lumens.py | UTF-8 | 1,429 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import RPi.GPIO as GPIO
from random import randint
import logging
from apscheduler.schedulers.background import BackgroundScheduler
scheduler = BackgroundScheduler()
led_pins = {'r': 26, 'b': 20, 'g': 21, 'w': 19}
#set up gpio
print GPIO.VERSION
GPIO.setmode(GPIO.BCM)
class Lumens:
def __init__(self):
... | true |
eef88e05a36ee6c3c58708569a13d1f704a716af | Python | xbliss/photons-core | /modules/photons_tile_paint/twinkles.py | UTF-8 | 4,508 | 2.65625 | 3 | [
"MIT"
] | permissive | from photons_tile_paint.animation import Animation, coords_for_horizontal_line, Finish
from photons_tile_paint.options import AnimationOptions
from photons_themes.theme import ThemeColor as Color
from photons_themes.canvas import Canvas
from delfick_project.norms import dictobj, sb
import random
# Palettes from https... | true |
6d59ba5ea4e06d23720d090ebac95bbc65529383 | Python | omar20261/python-examples | /Http_Req.py | UTF-8 | 206 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
import urllib3
def main():
MyUrl="https://www.google.com.eg/";
http = urllib3.PoolManager()
data= http.request('GET',MyUrl);
print(data)
if __name__ == "__main__":main()
| true |
967284cdbcf86d61d77409e8ca2d97e04443901b | Python | Pluto-Zmy/Python-OJ | /5/2. Prime.py | UTF-8 | 196 | 3.84375 | 4 | [] | no_license | def isPrime(num):
for i in range(2, num):
if num % i == 0:
return False
return True
def primeSum(m, n):
sum = 0
for num in range(m, n + 1):
if isPrime(num):
sum += num
return sum
| true |
9ff3f79ad99496d030abb533b6e1d9b3bd58cbdd | Python | rookzeno/kprlibrary | /葉からdfs.py | UTF-8 | 649 | 2.546875 | 3 | [] | no_license | import sys
sys.setrecursionlimit(200000)
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
if a[0] != 1:
a[0] = 1
ans += 1
b = [[]for i in range(n)]
for i in range(n):
b[a[i]-1].append(i)
b[0].remove(0)
huka = 0
kyo = [float("inf")] * n
def dfs(x,y):
kyo[x] = y
for i in b[x]:
dfs(i... | true |
132e94eb729cc02437a85444f005647c1a940bb6 | Python | bravesoftdz/delphi-epidata | /src/acquisition/cdcp/cdc_dropbox_receiver.py | UTF-8 | 4,411 | 2.96875 | 3 | [
"MIT"
] | permissive | """
===============
=== Purpose ===
===============
Downloads CDC page stats stored in Delphi's dropbox.
This program:
1. downloads new files within dropbox:/cdc_page_stats
2. moves the originals to dropbox:/cdc_page_stats/archived_reports
3. zips the downloaded files and moves that to delphi:/common/cdc_stage
... | true |
37b14e5317ef55843148ef4abf807fad94391660 | Python | FedericoBaron/my-portfolio | /cop3223H/Code/turtleeee.py | UTF-8 | 112 | 2.6875 | 3 | [] | permissive | import turtle
turtle.fd(50)
turtle.lt(90)
turtle.fd(50)
turtle.lt(90)
turtle.fd(50)
turtle.lt(90)
turtle.fd(50)
| true |
a1d57bec8e0f2b7fdd6df0305c650d438f7be081 | Python | Cenation2812/Python-projects | /Ladder.py | UTF-8 | 147 | 3.109375 | 3 | [] | no_license | n=int(input())
l=n*2+2
length=n+l
for i in range(1,length+1):
if i%3==0:
print("*****")
else:
print("* *")
| true |
df6d53a56f9cac59357a42f50b79bb03b4cbba6c | Python | Hott-J/Preparing-Programming-Interviews | /[03]전화 예비 면접/중첩 괄호.py | UTF-8 | 378 | 3.765625 | 4 | [] | no_license | #괄호가 제대로 중첩되었는지 판단
s="(())"
s1="()()"
s2="(()()"
s3=")("
flag=True
def solution(s):
#flag=True
cnt=0
for i in range(len(s)):
if s[i]=="(":
cnt+=1
else:
cnt-=1
if cnt<0:
return False
if cnt==0:
return True
return ... | true |
09f4b19824eeea29ad339245ef1adf81e7376b21 | Python | Adelina360/Python_Projects | /Problem Solver/Problem Solver.py | UTF-8 | 925 | 3.734375 | 4 | [] | no_license | # People have many problems but they can solver their problems with this
print('WRITE ALL WITH LOWERCASE')
def funcion():
word = input('Your problem: ')
funcion()
def funcion_2():
word_2 = input('Cause of the problem: ')
funcion_2()
def funcion_3():
word_3 = input('Solution:... | true |
b8c03bd29ef349eb0b876b4634032b19e8ad0ced | Python | afilipch/nrlbio | /tasks/targets_ligated_not_to_perfect.py | UTF-8 | 2,135 | 2.546875 | 3 | [] | no_license | #! /usr/lib/python
'''Script answers to the question: How many clusters have a perfect seed match for one of the top N expressed miRNAs families, but were actually found ligated to another miRNA?'''
import argparse
import os
import sys
from pybedtools import BedTool
from collections import defaultdict
from nrlbio.mi... | true |
7ea1202d8394ba17b4431990a0565eb57db7d169 | Python | dlrgy22/Boostcamp | /2주차/2021.01.25/예제/vector.py | UTF-8 | 647 | 3.4375 | 3 | [] | no_license | import numpy as np
def l1_norm(x):
x_norm = np.abs(x)
x_norm = np.sum(x_norm)
return x_norm
def l2_norm(x):
x_norm = x*x
x_norm = np.sum(x_norm)
x_norm = np.sqrt(x_norm)
return x_norm
def angle(x, y):
v = np.inner(x, y) / (l2_norm(x) * l2_norm(y))
theta = np.arccos(v)
return theta
x = np.array([0, 1])
y =... | true |
4edc5ce01e03f5f30d81b63477f8485b618d9870 | Python | enessitki/wikiHow | /qt-modelviewcontroller-example/classes/Views.py | UTF-8 | 794 | 2.71875 | 3 | [] | no_license | from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
class FilesView(QWidget):
def __init__(self, parent=None):
super(FilesView, self).__init__(parent=parent)
self.scanButton = QPushButton("Scan")
self.filesLabel = QLabel("")
self.deleteBut... | true |
e5c3fbda41fab0f9e7d8979145a580ee414c1d89 | Python | nakagawaneal/my-new-repo1 | /test_employee.py | UTF-8 | 4,150 | 3.109375 | 3 | [] | no_license | import unittest
from employee import Employee
class TestEmployee(unittest.TestCase):
def test_email(self): #we're creating 2 employees
emp_1 = Employee('Corey', 'Schafer', 50000)
emp_2 = Employee('Sue', 'Smith', 60000)
self.assertEqual(emp_1.email, 'Corey.Schafer@email.com')
self... | true |
8721479f068078dd85e3a7619f6387e6c5633e94 | Python | Rock1311/Python_Practise | /unique_list_from_two_diff_list.py | UTF-8 | 311 | 3.953125 | 4 | [] | no_license | ##print unique list from 2 different lists
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2,2, 3, 4,5, 5, 6, 7, 8, 9, 10, 11, 12, 13]
c= []
d=[]
for x in a:
for y in b:
if (x==y):
c.append(x)
print(c)
for x in c:
if (x not in d):
d.append(x)
print(d)
| true |
7794390e1c780b7069d0c03de4dce6d0384566d8 | Python | TonyBoy22/gittest | /Python/displaying data/learn_venv/Lib/site-packages/ground/core/angular.py | UTF-8 | 890 | 2.796875 | 3 | [] | no_license | from .enums import (Kind,
Orientation)
from .hints import (Point,
QuaternaryPointFunction,
Scalar)
def kind(vertex: Point,
first_ray_point: Point,
second_ray_point: Point,
dot_producer: QuaternaryPointFunction[Scalar]) -> Kind:
... | true |
8b1f8e3fe31be65a1292f710628e9cbe6cdb4284 | Python | allenlipeng47/AlgorithmPy | /sort/QuickSelect.py | UTF-8 | 745 | 3.328125 | 3 | [] | no_license | class Solution(object):
def select(self, arr, k):
return self.partition(arr, 0, len(arr) - 1, len(arr) - k)
def partition(self, arr, low, high, k):
if low > high:
return -1
l, h, pivot = low, high, arr[low]
while l < h:
while l < h and pivot <= arr[h]:
... | true |
976f7e66565a36cbec543f0fa08419542edb0381 | Python | e-v-mst/cpp_code-kata | /Python_Code_Kata/ClassGraph/ClassGraph.py | UTF-8 | 843 | 3.078125 | 3 | [] | no_license | classMap = {'object':list()}
def find_path(start, end, path = [] ):
if start not in classMap:
return None
path = path + [start]
if start == end:
return path
for node in classMap[start]:
#if node not in path:
newpath = find_path(node, end, path)
if newpath:
... | true |
d13aa7b84b80cca9ff6ae0563a1e7405fe3ae0aa | Python | hyusterr/Text-Mining | /hw3/hw3-b05702095.py | UTF-8 | 9,167 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[46]:
import os
import sys
import nltk
nltk.download('stopwords') # download stopwords lexion
nltk.download('punkt') # download tokenize related tools
import numpy as np
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem.porter impo... | true |
0f930a30941d0ade8bae4a7c417ed4f22b2c1f2b | Python | luochonglie/tf | /open_cv/cv_02_visit_bits.py | UTF-8 | 1,382 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 25 16:09:58 2016
按位操作图片
@author: chonglie
"""
import cv2
import numpy as np
from open_cv import cv_01_read_copy_write as img_utils
def salt(img, num):
"""在图片上加入白色的噪点
:param img: 图片
:param num: 噪点数量
:return: 增加噪点后的图片
"""
print(img.shape)
for i... | true |
14232a52b58c06bafd7a1084d458eca490b98674 | Python | SebastianThomas1/coding_challenges | /hackerrank/algorithms/implementation/designer_pdf_viewer.py | UTF-8 | 648 | 3.21875 | 3 | [] | no_license | # Sebastian Thomas (coding at sebastianthomas dot de)
# https://www.hackerrank.com/challenges/designer-pdf-viewer
#
# Designer PDF Viewer
ALPHABET = 'abcdefghijklmnopqrstuvwxyz'
IDX_OF_CHAR = {char: idx for idx, char in enumerate(ALPHABET)}
def designer_pdf_viewer(h, word):
return max(h[IDX_OF_CHAR[char]] for c... | true |
c511034c6195a3d9a9c89e897e4881714f5dac1c | Python | chrishart0/GildedRose-Refactoring-Kata | /python/test_gilded_rose.py | UTF-8 | 7,104 | 3.234375 | 3 | [
"MIT"
] | permissive | #!/bin/python3
# -*- coding: utf-8 -*-
import unittest
from gilded_rose import Item, GildedRose
class GildedRoseTest(unittest.TestCase):
def item_are_valid_tests(self, items):
'''
A series of constraints an item should always abide by
Use this on every test
'''
valid = Tru... | true |
7cfb5d2a8c824bc0e22cbc66f9be0bc0e1fc966a | Python | ffhan/lingua | /automata/fa.py | UTF-8 | 14,304 | 3.40625 | 3 | [
"MIT"
] | permissive | """
Defines finite automata abstract class.
In other words, it defines an interface that all derived classes have to follow.
"""
import abc, copy
import automata.state as st
import automata.packs as pk
class FiniteAutomaton(abc.ABC):
"""
Finite automata base abstract class. It isn't aware of transition functio... | true |
db3b6fc01878b2b90179a7ff027dcbdc6eaebd23 | Python | ArvidLandmark/Twitter-sentiment-analyzer | /twitter.py | UTF-8 | 5,024 | 2.609375 | 3 | [] | no_license | import tweepy as tw
from textblob import TextBlob
from openpyxl import Workbook
from openpyxl.styles import Font
def paste_cells(ws_feed):
for il in range(len(excel_pos)):
ws_feed.cell(il*7+2, 1).value = search_list()[il]
ws_feed.cell(il * 7 + 2, 1).font = Font(bold=True)
ws_feed... | true |
a6dc0dabf394bc92b470153a342775880d35c108 | Python | hudsonchromy/kattis | /t9spelling.py | UTF-8 | 608 | 2.65625 | 3 | [] | no_license | trans = {'a': '2', 'b': '22', 'c':'222', 'd':'3', 'e':'33', 'f':'333', 'g':'4', 'h':'44', 'i':'444', 'j':'5', 'k':'55', 'l':'555', 'm':'6', 'n':'66', 'o':'666', 'p':'7', 'q':'77', 'r':'777', 's':'7777', 't':'8', 'u':'88', 'v':'888', 'w':'9', 'x':'99', 'y':'999', 'z':'9999', ' ':'0'}
cases = int(input())
for j in range(... | true |
b9fa03d24b0ebde9538db4f3df24680076079862 | Python | redelste/CS559 | /hw1/Assignment1.py | UTF-8 | 1,078 | 3.203125 | 3 | [] | no_license |
# coding: utf-8
# In[8]:
import numpy as np
import math
# In[149]:
#non custom input
def observations():
N = [10, 100, 1000]
neat = np.random.normal(0, 1, (N[0], 1))
neat1 = np.random.normal(0,1,(N[1], 1))
neat2 =np.random.normal(0,1,(N[2], 1))
#mean for 10
m1 = sum(neat) / 10
... | true |
ca480580333ed78d63e1c313be9550ba5426b761 | Python | wschmitt/pynes | /emulator.py | UTF-8 | 3,303 | 2.703125 | 3 | [] | no_license | import cpu_opcodes
from cpu import CPU
from ppu import PPU
from ram import RAM
from rom import ROM
class Emulator:
def __init__(self):
self.MEMORY_SIZE = 0x800 # 2kB
self.rom = None
self.ram = RAM(self.MEMORY_SIZE)
self.cpu = CPU(self.cpu_read, self.cpu_write)
... | true |
ae21c861cb3a7f5ea86d7e25b5e38a696ec9d47e | Python | MJSahebnasi/SearchOnGrid | /Main.py | UTF-8 | 1,136 | 3.0625 | 3 | [] | no_license | from bfs import bfs
from matrix_stuff import read_matrix, find_index, draw_path
from dfs import dfs
from A_star import a_star # , a_star_wikiVersion
from collections import deque
matrix = read_matrix()
# print('primary map:')
# for row in matrix:
# print(row)
# print()
(start_y, start_x) = find_index(matrix, 'S')... | true |
05f41c3ee0dc4b326d19ea9c29ddd10db66f311f | Python | Yu-Igarashi-aiiit/SelfStudying | /atcoder/test.py | UTF-8 | 822 | 3.015625 | 3 | [] | no_license | "map int input": {
"prefix": "mpi",
"body": [
"map(int,input().split())"
],
"description": "map int"
}
"list map int": {
"prefix": "lmpi",
"body": [
"list(map(int,input().split()))"
],
"description": "list map int"
}
"resolve": {
"prefix": "res",
"body": [
"def resolve():"
... | true |
73f4870a30f7f87c0db8082a910090624cdac8c0 | Python | davzha/DESP | /datasets/polygons.py | UTF-8 | 1,667 | 2.828125 | 3 | [] | no_license | import math
import random
import torch
TWO_PI = 2 * math.pi
class Polygons(torch.utils.data.Dataset):
def __init__(self, n_points, n_poly, radius=0.35, noise=True, length=60000, mem_feat=False, mode=None):
self.n_points = n_points
self.length = length
self.center = torch.tensor((0.5,0.5))... | true |
35b261afadd3c90e030a814fd0c274b7849ce29e | Python | ninjaihero/GeoPix | /GP/Assets/code/extensions/SaveLoad.py | UTF-8 | 6,787 | 2.640625 | 3 | [
"LicenseRef-scancode-proprietary-license",
"MIT"
] | permissive | """
SAVE LOAD is an extension for making a component or it's sub components saveable.
"""
import SaveLoadGlobal
class SaveLoad:
"""
SaveLoad description
"""
def __init__(self, ownerComp):
# The component to which this extension is attached
self.ownerComp = ownerComp
def SaveLoad_GET( self ,
root_op ,
... | true |
f60ee09e83d4c6943db7e63f3e7db5a01d452174 | Python | cxu60-zz/LeetCodeInPython | /longest_common_prefix.py | UTF-8 | 1,415 | 3.734375 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
longest_common_prefix.py
Created by Shengwei on 2014-07-15.
"""
# https://oj.leetcode.com/problems/longest-common-prefix/
# tags: easy / medium, array, string, pointer, logest, D&C, edge cases
"""
Write a function to find the longest common prefix string amongst an array o... | true |
2cde7e1e6f52c53d37d4329de6b184439548aaed | Python | mvanveen/musicDB | /encounter.py | UTF-8 | 2,055 | 3.296875 | 3 | [] | no_license | # Encounter.py
# ==============================================================================
# Michael Van Veen
# 03/08/10
# ==============================================================================
# Checks to see if a file exists in DB.
# =======================================================================... | true |
0696a1eb1b199494d64f5336db4eb68bf2cfa217 | Python | mrtonks/PythonCourses | /Python Programming/Chapter 6/Exercise2.py | UTF-8 | 170 | 4.03125 | 4 | [] | no_license | #Sample for loop program
#First create a list
this_list = [45, 14, 65, 42, 34]
#Create the for loop
for content in this_list:
print content
print "It's the end."
| true |
5819198dd49c436c6c0bb999ebf234b9fb2f48f7 | Python | hawksong/pythontest | /pylearn/src/test/qing.py | UTF-8 | 233 | 3.3125 | 3 | [] | no_license | '''
Created on 2017年12月8日
@author: user
'''
def printinfo( arg1, *vartuple ):
"This prints a variable passed arguments"
print ("Output is: ")
print (arg1)
for var in vartuple:
print (var)
return | true |
b01d1a24c338a720426a7ef8678d32f0d0435b76 | Python | harshit-ladia/Excel-to-SQL | /myfile.py | UTF-8 | 349 | 2.859375 | 3 | [] | no_license | import pandas as pd
my_data = pd.read_csv(r"file.csv")
table = input()
query=[]
# my file had id as a column
for j in range(my_data['Id'].count()):
query.append("Insert into " + table + " values({},{});".format(my_data.iloc[j,0],my_data.iloc[j,1]))
with open("insert_query.sql","a") as sql:
for i in quer... | true |
d4d721f5c3788b68f1d027480612572bcf999352 | Python | DimaAnsel/GraphicsFinal-3DRenderer | /src/model_creator.py | UTF-8 | 29,476 | 2.84375 | 3 | [] | no_license | ################################
# model_creator.py
# Noah Ansel
# nba38
# 2016-11-17
# ------------------------------
# Generates models of different resolutions
# for use in main rendering program.
################################
# import validation
fail = False
try:
from numpy import *
except Exception:
print(... | true |
27f1b357d40888e1fd534944aad45048e59e4035 | Python | crudelens/prog_fr_art | /day03/todo.py | UTF-8 | 1,234 | 4.09375 | 4 | [] | no_license | # Shopping list
shopping_list = []
# Menu
def menu_serve():
print('''
Choose an option:
1. Add Item
2. Remove Item
3. Show List
4. Quit
''')
# Add item
def add_item(item_name):
shopping_list.append(item_name)
print(f'{item_name} added to list\n {shopping_list}')
# remo... | true |
f20859d7c36966a687091744abc2a3c2b62114fe | Python | jkoser/euler | /work/p314.py | UTF-8 | 3,947 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python3
from fractions import Fraction
from math import sqrt
ratiomax = 0
bestpath = []
def step(r, pos, slope, path, area, perim):
global ratiomax
global bestpath
x, y = pos
if y == x - 1 or (slope == 1 and (x + y) % 2 == 1):
d = (x - y - 1) // 2
pos1 = x1, y1 = (x - d... | true |
b4d5b99fcd12af9a88112f9e0b24b41183055701 | Python | DavidLohrentz/LearnPy3HardWay | /puppies.py | UTF-8 | 171 | 3.171875 | 3 | [] | no_license |
reps = int(input("\n\tHow many times to display puppy tracks? "))
print(f"\N{PAW PRINTS}" * reps)
# a = 0
# while a < reps:
# a += 1
# print(f"\N{PAW PRINTS}")
| true |
f5f250694bb03fa18efd2a28fa0640ca136176cf | Python | vpozdnyakov/fca_lazy_clf | /setup.py | UTF-8 | 1,967 | 2.828125 | 3 | [
"MIT"
] | permissive | import setuptools
setuptools.setup(
name='fca_lazy_clf',
packages=['fca_lazy_clf'],
version='0.3',
license='MIT',
description='Lazy binary classifier based on Formal Concept Analysis',
long_description="""
### Installation
```sh
$ pip install fca_lazy_clf
```
### Requirements
The train and ... | true |
70f3b5a7de972d6428a84012c41978696ddc2579 | Python | Vinograd17/Python | /HW 5/hw5_task_1.py | UTF-8 | 230 | 3.75 | 4 | [] | no_license | # Task 1
with open('my_file.txt', 'w') as f_obj:
while True:
if input('To stop enter "q", any other letter to continue: ') == 'q':
break
line = input('Enter text: ')
print(line, file=f_obj)
| true |
bff71f635c0913bcb0bf79f6f5c7c9a172bd8b8a | Python | sdytlm/sdytlm.github.io | /downloads/code/LeetCode/Python/Reconstruct-Itinerary.py | UTF-8 | 560 | 3.359375 | 3 | [] | no_license | class Solution(object):
def findItinerary(self, tickets):
"""
:type tickets: List[List[str]]
:rtype: List[str]
"""
# Create a dict with list in the value part
target = collections.defaultdict(list)
for i,j in sorted(tickets)[::-1]:
targets[i] += j,... | true |
804531a04e9c8fa5ac38f51243885917ba825bb2 | Python | NicoJG/Anfaengerpraktikum | /V355/frequenzentheorie.py | UTF-8 | 1,413 | 2.6875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import json
from scipy.optimize import curve_fit
def vMinus_theorie(L,C,Ck):
return 1/(2 *np.pi * np.sqrt(L/((1/C)+2/(Ck))))
def vPlus_theorie(L,C):
return 1/(2*np.pi*np.sqrt(L*C))
# Konstanten im Experiment
L = 23.9540 * 10**(-3)
C = 0.7932 *10... | true |
557378b33172f2e48e27db48be5f3e27144ff4fa | Python | unclebae/python3-data-analysis | /ch02/convertArray.py | UTF-8 | 439 | 3.703125 | 4 | [] | no_license | # _*_ coding: utf-8 _*_
import numpy as num
a = num.array([ 1. + 1.j, 3. + 2.j])
print("num.array([ 1. + 1.j, 3. + 2.j]) : ", a)
# tolist()함수를 이용하여 배열을 리스트로 변환한다.
print("a.tolist() : ", a.tolist())
# 배열을 특정 타입의 배열로 변환한다.
print("a.astype(int) : ", a.astype(int))
# 배열을 복소수형 타입으로 변환한다.
print("a.astype('complex') : "... | true |
a807f3f31808e7042d17b0a9611669a780b30b75 | Python | FP1212/FP | /Test_QUEEN_ATTACK_Federico_Pinilla_Tarazona/Test_QueenAttack.py | UTF-8 | 2,500 | 2.8125 | 3 | [] | no_license | '''
Created on 17/10/2019
@author: FP
'''
import array
n=0;
k=0;
rq=0;
cq=0;
ro=0;
co=0;
p=255;
limite_inferior=0;
limite_superior=100000;
direccion=8;
cuadros_restantes=0;
import re
parametros_in=open("prueba.txt","r");
acumulador=0;
for lineas in parametros_in.readlines(): ... | true |
aad1dba2d235dbcd830545d6e9e3f883a5b59bf0 | Python | jaabee/daily_code | /Django_Code/mysite/blog/forms.py | UTF-8 | 962 | 2.5625 | 3 | [] | no_license | # @Time : 2020/11/17 21:38
# @Author : GodWei
# @File : forms.py
from django import forms
from .models import Comment
# Django表单,通过继承Form基类创建了一个表单
class EmailPostForm(forms.Form):
# 该字段类型显示为<input type='text'>HTML元素
name = forms.CharField(max_length=25)
email = forms.EmailField()
to = forms.Ema... | true |
f47adc889daa101d6697768e037a7c9e09a9ec2b | Python | mkt-Do/codewars | /python/tests/test_sum_of_numbers_from_0_to_N.py | UTF-8 | 424 | 3.6875 | 4 | [] | no_license | from codewars.sum_of_numbers_from_0_to_N import show_sequence
from codewars.test import Test
class TestSumOfNumbersFrom0ToN(Test):
def test_show_sequence(self):
self.describe("Example Tests")
tests = (
(6, "0+1+2+3+4+5+6 = 21"),
(7, "0+1+2+3+4+5+6+7 = 28"),
(0, "0=0"),
(-1, "-1<0"),
... | true |
e15a108c13d3a66312478bd2159f90e39adda5e0 | Python | DaianeFeliciano/python-fatec | /atv105.py | UTF-8 | 1,778 | 4.28125 | 4 | [] | no_license | import os
import sys
def lerNumero():
N = int(input('Digite um número: '))
return N
def numeroParouImpar(N):
if N % 2 == 0:
print("Número {} é par".format(N))
return True
else:
print("Número {} é impar".format(N))
return False
def numeroPrimo(N):
contdiv = 0;
... | true |
f6c8f7a8b5ca78935d060f50f264ca2b83c177ea | Python | ketasaka/Python_study | /提出/sakamotokeita_1_10.py | UTF-8 | 199 | 4.09375 | 4 | [] | no_license | a = input("文字の入力:")
b = int(input("整数の入力:"))
c = input("小数の入力:")
print("入力された文字 =",a)
print("入力された整数 =",b)
print("入力された小数 =",c) | true |
938915d4fe69c7a61b5303d25f7aa2d6e060362c | Python | arunkumarpalaniappan/algorithm_tryouts | /arrays_matrices/compression.py | UTF-8 | 635 | 3.203125 | 3 | [
"MIT"
] | permissive | def compressString(string):
newString = ''
index = 0
tempCount = 1
while index < len(string):
tempIndex = 1
while index+tempIndex < len(string) and string[index] == string[index+tempIndex]:
tempCount+=1
tempIndex+=1
newString = newString + string[index]+st... | true |
ec4d7e70f8b229d97fa0c8033f087a46f7d8ccf3 | Python | kurtw29/algorithmPractice | /maxPalindrome.py | UTF-8 | 1,846 | 3.625 | 4 | [] | no_license | def findPalindromeLength(index, arr):
#odd palindrome
trackerOdd = 1
i = 1
while(index-i >= 0 and index+i < len(arr)):
if arr[index-i] == arr[index+i]:
trackerOdd += 2
i += 1
else:
break
#even palindrome
trackerEven = 0
if index < len(arr)-... | true |
35ed736b6d2ebedefb6eac7b916957a370efabe6 | Python | knschuckmann/Modul-Learning-From-Images | /lfi-01/Dennis Baskan/lfi-01/filter.py | UTF-8 | 3,351 | 3.6875 | 4 | [] | no_license | """
Kostja Comments:
- Can u explain the ravel() function and why you dont give it a order?? in im2double
- when using convolution2d is it fastser to create the variables and not claculate with calculated values?
- Very nice codestyle
- Is Gausian Vlur required before aplying the sobel?
- why do yo... | true |
52b1ed386f65bb237f6737a2b76febad05f5a0b3 | Python | BnkColon/parallel | /mergeParallel.py | UTF-8 | 6,761 | 3.40625 | 3 | [
"MIT"
] | permissive | # Bianca I. Colon Rosado
# This file is: mergeParallel.py
# To compile $ python mergeParallel.py
# I make this program last semester after CCOM3034.
# Learning Parallel and learning Python for my own in a Coursera class.
# http://www.tutorialspoint.com/python/python_multithreading.htm
# https://docs.python.org/dev/... | true |
55148641c7e637e19ad100e0aa596a304c74241a | Python | LuciraSilva/FreelaDev | /app/models/contractor_model.py | UTF-8 | 2,011 | 2.78125 | 3 | [] | no_license | from app.configs.database import db
from dataclasses import dataclass
from werkzeug.security import generate_password_hash, check_password_hash
import re
from flask import request, jsonify
@dataclass
class ContractorModel(db.Model):
name: str
email: str
cnpj: str
__tablename__ = 'contractors'
... | true |
8f21b4e9a89dc3e6605ec185a87bb98992fc667b | Python | Aasthaengg/IBMdataset | /Python_codes/p03146/s788338217.py | UTF-8 | 195 | 3 | 3 | [] | no_license | s=int(input())
a=[s]
res=0
while True:
tmp=0
if a[res]%2==0:
tmp=a[res]/2
else:
tmp=3*a[res]+1
res+=1
if tmp in a:
break
a.append(tmp)
print(res+1) | true |
4fcd5f7a94f65e8208038c8f3ad8ad80fbf84495 | Python | zhipenglu/xist_structure | /pca2tracks.py | UTF-8 | 1,819 | 2.796875 | 3 | [] | no_license | """
pca2tracks.py
This script converts the PCA analysis results for RIP/CLIP enrichment to a
minimal number of tracks for display on IGV. This approach provides more useful
information than the heatmap. The input file is *pca_array.pc.txt, and output
are the first few tracks that explain the most variance (e.g. *pc1.b... | true |
41661be35d826e93188e0074f02d1248dcb4317f | Python | chang-change/9eqModel_KNFandLSTM | /Post-processing/compare_long_term_statistics.py | UTF-8 | 3,843 | 2.9375 | 3 | [] | no_license | """
compare_long_term_statistics.py
---------------------
This file compares the performance of KNF, HDMD, and LSTM models in the
reproduction of the long-term statistics by producing Figures 5 of the paper.
Requires:
stats_KNF_model_name.npz - reproduction of the long-term statistics by KNF.
stats_HD... | true |
dd955cbd954e5f4a914336c509e4a38b115f07c4 | Python | mgzhao/test | /modelmanager/distributed.py | UTF-8 | 2,167 | 2.609375 | 3 | [] | no_license | import os
import random
import torch.distributed as td
from torch.multiprocessing import Process
def train(Model, model_args):
# Run one worker node for each gpu
gpus = model_args['gpus']
model_args["distributed"]["world_size"] *= len(gpus)
processes = []
for gpu in gpus:
p = Process(targ... | true |
d244e73f778f596c0c9f213c7f83175c7079fff9 | Python | hemanthkumark005/Insurance_classification_task | /trainer/model.py | UTF-8 | 1,965 | 2.53125 | 3 | [] | no_license |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.python.saved_model import builder as saved_model_builder
from tensorflow.python.saved_model import signature_constants
... | true |
a029f8b95bc862ea028df7eaa2d3f3ba9816b458 | Python | alexhkurz/introduction-to-programming | /src/insertion_sort.py | UTF-8 | 534 | 4.03125 | 4 | [] | no_license | list = [2,1]
def mysort(list):
new_list = [] # the sorted list
for x in list:
# insert x in new_list
j = 0 # j is used to computer the index where to insert x
# compare x against the elements y of new_list
for y in new_list:
if x <= y:
... | true |
85c9b1df58172c0eb2a2f5a4ac6185c8807913bf | Python | linea-it/tno | /backend/skybot/skybot_server.py | UTF-8 | 11,011 | 2.9375 | 3 | [
"MIT"
] | permissive | import os
from datetime import datetime
from io import StringIO
from urllib.parse import urljoin
import numpy as np
import pandas as pd
import requests
from requests.exceptions import HTTPError
class SkybotServer:
"""Esta classe tem a função de facilitar consultas ao serviço Skybot."""
def __init__(self, ur... | true |
1fb9d230a339be93c1da0bd1679a6a53d2dec39b | Python | quarkgluant/exercism | /python/perfect-numbers/perfect_numbers.py | UTF-8 | 376 | 3.5625 | 4 | [] | no_license | def classify(number):
if number <= 0:
raise ValueError('then number must be strictly posistive')
sum = sum_aliquots(number)
if sum == number:
return 'perfect'
elif sum > number:
return 'abundant'
else:
return 'deficient'
def sum_aliquots(number):
return sum(set(... | true |
5ca558d6794e3937f8793f63cf2f1d4cab72add2 | Python | shivam90y/practice-py | /practice4.py | UTF-8 | 156 | 3.640625 | 4 | [] | no_license | # Write a Python program to convert a tuple to a string.
tup = ('S', 'h', 'i', 'v', 'a', 'm', ' ', 'y', 'a', 'd', 'a', 'v')
str = ''.join(tup)
print(str) | true |