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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
eb2919dacdfe56bd0c59f5bcc7dec591aeb0f8af | Python | rmccampbell/PythonProjects | /music.py | UTF-8 | 4,102 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
import pygame, sys, os
from pygame.locals import *
def load_sound(name):
base = os.path.dirname(__file__)
fullname = os.path.join(base, 'data', 'sounds', name + '.wav')
return pygame.mixer.Sound(fullname)
class Note(pygame.sprite.Sprite):
def __init__(self, pitch):
self.... | true |
8a4f50ac473894390e2e4a484cd99cf0b2dce065 | Python | aduston/simpledrawers | /drawers.py | UTF-8 | 2,021 | 2.609375 | 3 | [] | no_license | from OCC import gp, TopLoc
from OCC.Display.SimpleGui import init_display
from OCC.TopoDS import TopoDS_Builder, TopoDS_Compound
from drawer import make_drawer
from drawer_box import make_drawer_box, BACK_INSET
from constants import THICKNESS_0, THICKNESS_1
def _move(shape, x, y, z):
tr = gp.gp_Trsf()
tr.SetTr... | true |
0bbd599e86178ec3aff32f1e9c33b3072c6c3674 | Python | lleskow/lapie-code | /seconde/assets/imgll.py | UTF-8 | 1,474 | 3.328125 | 3 | [] | no_license | from PIL import Image
from os.path import splitext
def appliquer_fonction_vers_nb(f,image,mode_depart):
im = Image.open(image)
largeur, hauteur = im.size
im2 = Image.new("L",im.size)
for y in range(hauteur): #parcours des lignes
for x in range(largeur): #parcours des colonnes d'une ligne
... | true |
9b4badc87ebb241607ef726b00e27a5dabe96d60 | Python | ktarrant/stockfinder | /stock/candlestick.py | UTF-8 | 2,689 | 2.9375 | 3 | [] | no_license | from plotly.tools import FigureFactory as FF
import stock.indicators as indicators
import pandas as pd
class Candlestick(dict):
""" Class for managing a candlestick stock figure. """
CUSTOM_MARKERS_ENABLED = False
VOLUME_ENABLED = False
def __init__(self, df, primaryKey="Close"):
super(Candle... | true |
c9e57e35356dc751b18b73d1df2d759e6bef9ef3 | Python | mlevesquedion/Scrapy | /HTMLparser.py | UTF-8 | 448 | 2.78125 | 3 | [] | no_license | from bs4 import BeautifulSoup
class HTMLparser:
def __init__(self):
self.soup = None
def is_set(self):
return self.soup is not None
def set_html(self, html):
self.soup = BeautifulSoup(html, 'html5lib')
def get_pattern_matches(self, pattern):
return se... | true |
7d8443525f62296b18cb258e44b19d5d69c165b6 | Python | israelcode/CG | /kp.py | UTF-8 | 6,343 | 2.65625 | 3 | [] | no_license | #coding=utf-8
import matplotlib as mpl
import numpy as np
from scipy.misc import comb
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import math
import pylab
from mayavi import mlab
from matplotlib.ticker import MaxNLocator
from matplotlib import cm
from numpy.random import randn
from scip... | true |
24d39bee0e36d2a144aad74cf86a201ca0b58dbb | Python | eangulee/python | /math/montecarlo.py | UTF-8 | 1,924 | 3.703125 | 4 | [] | no_license | import random
from sympy import *
import numpy as np
import matplotlib.pyplot as plt
import math
#montecarlo 求定积分
def calpai():
n = 1000000
r = 1.0
a, b = (0.0, 0.0)
x_neg, x_pos = a - r, a + r
y_neg, y_pos = b - r, b + r
count = 0
for i in range(0, n):
x = random.uniform(x_neg, x_p... | true |
d024eea1490b2cbd1a0cdc9e56f80dada5dfe14a | Python | Pareidollya/LAA- | /Boubble.py | UTF-8 | 266 | 3.25 | 3 | [] | no_license | vetor = [5,1,4,2,8,3452,76,23,56,657,123,-12345,5,5,66,4,2,23,643,234,3,0]
for j in range(len(vetor)):
for i in range((len(vetor)-1)-j):
num = vetor[i]
if vetor[i] > vetor[i+1]:
vetor [i] = vetor[i+1]
vetor[i+1] = num
print(vetor)
| true |
590ca20214a2e50da6e1eb7ab40701d7bdcac243 | Python | Catcheryp/CTF | /web/WebSecurityAcademy/jwt/3_weak_signing_key.py | UTF-8 | 1,164 | 3.234375 | 3 | [] | no_license | # Demo script for 'JWT Authentication Bypass via Weak Signing Key' video: https://youtu.be/ov9yT4WAuzI
import jwt
# Paste JWT token here
jwt_token = 'INSERT_TOKEN_HERE'
wordlist_file = '/usr/share/wordlists/rockyou.txt'
def attempt_fuzzing(secret_key, algorithm):
try:
decoded = jwt.decode(jwt_token, secre... | true |
965ae583b49a293f0ab96a2a985db13b3298db31 | Python | TaoyuMei/Python_Practice_DataScience | /Plotting.py | UTF-8 | 8,381 | 3.765625 | 4 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import numpy.matlib
from sklearn.cluster import KMeans
### Exercise 1. Plotting cell shapes
diatoms_data = np.loadtxt("diatoms.txt")
def plot_a_cell(cell, colour='b'):
"""input a numpy array of the 180 coordinates of the 90 landmark points in 'x1, y1, x2... | true |
1d083c13cf187413922ba01c4aa498a7994c08dd | Python | stfc/PSyclone | /src/psyclone/psyir/transformations/loop_swap_trans.py | UTF-8 | 8,460 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | # -----------------------------------------------------------------------------
# BSD 3-Clause License
#
# Copyright (c) 2021-2022, Science and Technology Facilities Council.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... | true |
96323a1c267e06833cef6a6e1b0426da18e50911 | Python | mgracecar/python-packet-sniffer | /sniffer.py | UTF-8 | 40,897 | 3.3125 | 3 | [] | no_license | '''
Jesus Linares
Brandon Deen
Mariana Flores
Geoff Graham
Description:
This Linux and Windows application processes packets in the local network and displays
the supported protocol's header and data.
Linux has support for link layer whereas Windows has support for network layer.
The header is displayed in the same f... | true |
a464871a4588d4d5583acf4e1744f74f7aeb10f6 | Python | AnandD007/Amazing-Python-Scripts | /Applying Bitwise Operations/Applying Bitwise operations.py | UTF-8 | 898 | 3.21875 | 3 | [
"MIT"
] | permissive | import cv2
src1= input("Enter the path of the image 1\n") #getting the path for first image
src1 = cv2.imread(src1)
#src1 = cv2.resize(src1,(540,540)) #resizing the image
src2 = input("Enter the path of the image 2\n") #getting the path for second image
src2 = cv2.imread(src2)
src2 = cv2.resi... | true |
31054b8c8a0f467e6e9e52cc70fdcbf25cfaf81d | Python | wpalafox/fundamentalsOfComp | /intro_interactivepro_python_p1/stopwatch.py | UTF-8 | 1,969 | 3.21875 | 3 | [] | no_license | # template for "Stopwatch: The Game"
import simplegui
# define global variables
count = 0
sec = 0
stops = 0
perfect_stops = 0
is_stopped = True
# define helper function format that converts time
# in tenths of seconds into formatted string A:BC.D
def format(count):
sec = count/100.0
min = int(sec/60)
if se... | true |
5d951b175b219350e3d3ab4e6f13393c9b6b945c | Python | Simplon-IA-Biarritz-1/the-movie-predictor-dehy | /entity/title_episode.py | UTF-8 | 569 | 3.21875 | 3 | [] | no_license | class TitleEpisode:
def __init__(self, dict):
self.tconst = dict['tconst']
self.parentTconst = None if dict['parentTconst'] == "\\N" else dict['parentTconst']
self.seasonNumber = None if dict['seasonNumber'] == "\\N" else int(
dict['seasonNumber'])
self.episodeNumber = No... | true |
8fcdee74637c10f217164f9133a921b9c9ca5066 | Python | tesschung/TIL-garden | /TIL/01_python/fibo.py | UTF-8 | 280 | 3.328125 | 3 | [] | no_license | def fibo_recursion(n):
if n < 2:
return n
else:
return fibo_recursion(n - 1) + fibo_recursion(n - 2)
def fibo_for(n):
if n < 2:
return n
a, b = 0, 1
for _ in range(n - 1):
a, b = b, a + b
return b
print('hello, world')
| true |
758610c79886c379331b5396b1bc0b27a00ecc40 | Python | snucml/rl-tutorial | /main2_Agent.py | UTF-8 | 7,206 | 2.765625 | 3 | [
"MIT"
] | permissive |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from replayBuffer import ReplayBuffer
class Agent_DDPG(object):
def __init__(self, action_size, state_size, action_limit,):
self.memory_size = 10000
self.replayBuffer = ReplayBuffer(self.memory_size)
self.sess = tf.... | true |
c761f348a1f4b954abc0ce8ba6dc43760611fbf8 | Python | DhirendraRaic/PYDhi | /Datatypes/list_operations.py | UTF-8 | 1,309 | 3.734375 | 4 | [] | no_license | numbers=[1,2,3,4,5]
extranumbers=[6,7,8]
s='dhoni'
# insertion opertions
# insert(), append(), extend()
# deletion operations
# remove(), pop(), clear()
# other operations
# count, index, .....
numbers.insert(2,'raja')
print(numbers)
numbers.append(12)
print(numbers)
sports=['cricket','baseball']
num... | true |
49cb20870166beda9681980e9605cce871cfaea2 | Python | u-ever/CursoEmVideoPython | /exercises/ex090_Dicionário_em_Python.py | UTF-8 | 290 | 3.5 | 4 | [] | no_license | aluno = dict()
aluno['nome'] = str(input('Nome: '))
aluno['media'] = int(input(f'Média de {aluno["nome"]}: '))
print('=-' * 30)
if aluno['media'] >= 7:
aluno['situação'] = 'Aprovado'
else:
aluno['situação'] = 'Recuperação'
for k, v in aluno.items():
print(f' - {k}: {v}') | true |
98729c8d09508b59a114c6b17f8330d4a0dfd983 | Python | dmesq/tic-tac-toe-online | /tic-tac-toe-server/src/server/GameManager.py | UTF-8 | 7,529 | 3.109375 | 3 | [] | no_license | import GameManagerMessages
class GameManager:
def __init__(self):
self.clients = {} # addr: name
self.addrs = {} # name: addr
self.games = {} # name: (is_occupied, in_game, is_turn, opponent)
# self.games: in_game | is_turn | player_state |
# --------+--... | true |
0d8ea7200e16e1e81ed2839a43476b6cd516d686 | Python | RohithYogi/Spoj-Solutions | /Spoj/CRDS - Cards.py | UTF-8 | 100 | 2.953125 | 3 | [] | no_license | t=input()
for i in range(0,t):
l=input()
s=(l*((3*l)+1))/2
s=s%1000007
print s
| true |
4c9c2ac8cd88798e6201c6d82942063b7d371b7c | Python | UWSEDS/homework-4-documentation-and-style-kychen37 | /df_from_url.py | UTF-8 | 1,082 | 3.6875 | 4 | [
"MIT"
] | permissive | """Requests and extracts a dataframe from a given link, and checks the dataframe for columns, length, and column types."""
import io
import requests
import pandas as pd
def read_link(some_link):
"""Extracts a dataframe from a provided link."""
urlData = requests.get(some_link).content
df = pd.read_csv(io.S... | true |
ae66fe34cabb015318a3a1e367bc49f13920564c | Python | masterchoi2020/python_basic | /basic_1/53.quiz10.py | UTF-8 | 369 | 2.546875 | 3 | [] | no_license | '''
Quiz) 프로젝트 내에 나만의 시그니처를 남기는 모듈을 만드시오.
조건: 모듈 파일명은 byme.py로 작성
(모듈 사용 예제)
import byme
byme.sign()
(출력 예제)
이 프로그램은 나도코딩에 의해 만들어졌습니다.
유튜브: http://youtube.com
이메일: nadocoding@gmail.com
'''
# byme 모듈 사용
import byme
byme.sign()
| true |
5b8f1f60d9a0b856c3d5170ecf30ab72c0104702 | Python | sumitpurandare/My_git_repo | /Print.py | UTF-8 | 455 | 3.8125 | 4 | [] | no_license | #print
#Compiled by : Sumit Purandare
print ("Hello World")
print ("""Hello World
hey awesome people out there
Wanna some fun with Python
""")
print ("Mon " "Tue " "Wed " "Thu " "Fri " "Sat " "Sun ")
print ("""\n
jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
... | true |
a6de4743fb52aeede04bb96a00b6c173b8ee26f6 | Python | DamoM73/Digital-Solutions-old | /IA2/query_database.py | UTF-8 | 430 | 2.84375 | 3 | [] | no_license | import sqlite3 as sql
def sql_query(db_file,command):
# connect to database
with sql.connect(db_file) as db:
cursor = db.cursor()
# run the command
cursor.execute(command)
return cursor.fetchall()
# ----- MAIN PROGRAM -----
DB_FILE = "./IA2/spotify_v2.db"
query = """
... | true |
48b7ea83046eb5b4a9e2a93ee7383daccba9c3cc | Python | EllieHachem/Some-projects | /Turtle-Library-day-16-start/main.py | UTF-8 | 840 | 3.15625 | 3 | [] | no_license | import test
from turtle import Turtle, Screen
#class can be inside module that is why if we say import Turtle
#we must type turtle.Turtle() to make this not like now easier
#<turtle.Turtle object at 0x7fa7182ae910(this is memory) turtle module and class created object at memory location here 0x7fa7182ae910 easy
#accing... | true |
0003e1c91e17f8e8e98e64a4a3343c2bf784ab37 | Python | ankits0207/ACB_Assignment_1 | /MT16121_problem3_1.py | UTF-8 | 1,389 | 3.578125 | 4 | [] | no_license | # MT16121
# Ankit Sharma
input_string = input("Enter the string ")
input_pattern = input("Enter the pattern ")
input_string_list = list(input_string)
input_pattern_list = list(input_pattern)
string_index_iterator = 0
temp_iterator = 0
temp_offset = 0
print_check = 0
offset_list = []
# Code to perform naive string m... | true |
68a69c9b83b62700404dff5b083534c402b39494 | Python | Aasthaengg/IBMdataset | /Python_codes/p02954/s697767943.py | UTF-8 | 236 | 3.1875 | 3 | [] | no_license | S = input()
N = len(S)
ans = [1]*N
for i in range(N-1):
if S[i] == S[i+1] == "R":
ans[i+2] += ans[i]
ans[i] = 0
for j in range(N-1,0,-1):
if S[j] == S[j-1] == "L":
ans[j-2] += ans[j]
ans[j] = 0
print(*ans) | true |
dad3bcd31db844464e296adfd4e8221e0abb5ce2 | Python | trollhoehle/pythonlights | /gnome_test.py | UTF-8 | 211 | 2.53125 | 3 | [
"MIT"
] | permissive | import pythonlights
import math
import time
ctrl = pythonlights.LEDUtils()
while True:
for t in range(0,100):
ctrl.set_gnome(max(5,int(255*math.cos(2.0*t/200*math.pi)**2)))
ctrl.send()
time.sleep(0.02)
| true |
dd957cd6e25269d13c5f747b0439979c38904f7e | Python | VictorTadema/How_to_think_project_Victor | /How to think/Week 3/Exercise 36.py | UTF-8 | 121 | 3.21875 | 3 | [] | no_license | from typing import Any, Union
tot = 0
for numbers in [2, 3, 4]:
squares = numbers ** 2
tot += squares
print(tot) | true |
e3c2677b47d4c5ae2949145c5e5e4b9a0402d912 | Python | lawrann/AI-for-stock-market-trending-analysis | /fyp_/Tweets/tweets_cleaner_remove_duplicate.py | UTF-8 | 11,828 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import json
import csv
import os
import re,string
from tqdm import tqdm
import pandas as pd
def unique(list1):
# insert the list to the set
list_set = set(list1)
# convert the set to the list
unique_list = (list(list_set))
return unique_list
month = ['01','02','... | true |
44d6bb3efe711025c225e9c9416561a3bed8ae9c | Python | danhtaihoang/protein-er | /19.11.0700_ACE_g1B/4plot_ct_di_top.py | UTF-8 | 2,534 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import sys
import numpy as np
import matplotlib.pyplot as plt
#get_ipython().run_line_magic('matplotlib', 'inline')
#pfam = 'PF00504'
#s = np.loadtxt('pfam_2_40k.txt',dtype='str')
#pfam_list = s[:,0]
pfam_list = ['PF00200']
#=======================================================... | true |
9c7ee58d2858ab716474b08ab1c6a7940dbdb097 | Python | lindafanglizhi/pytest_book1 | /src/chapter3/test_fixture_data.py | UTF-8 | 753 | 3.421875 | 3 | [] | no_license | # Author: lindafang
# Date: 2020-05-07 14:25
# File: test_fixture_data.py
import csv
import pytest
@pytest.fixture()
def data():
test_data = {'name': 'linda', 'age': 18}
return test_data
def test_login(data):
name = data['name']
age = data['age']
print("我的名字叫:{},今年{}。".format(name, age))
@pyt... | true |
d238058f8482b02aad744eb9363dd0e17765eb78 | Python | nandini0727/MongoDB-Complex-Object-Creation | /Project2_department.py | UTF-8 | 2,207 | 3.203125 | 3 | [] | no_license |
## File to generate JSON with department as root
from pymongo import MongoClient
#Connect to Mongo client on port number 27017
mongo = MongoClient('localhost', 27017)
#initialize mongodb collections to variables
project_db = mongo.MongoProject.project
department_db = mongo.MongoProject.department
department_data =... | true |
1487d39559d20532d1c6cf83f3ab7b7a4c391235 | Python | jdcs/TheWxPythonTutorial | /FirstSteps/nominimizebox.py | UTF-8 | 293 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# nominimizebox.py
import wx
app = wx.App()
window = wx.Frame(None, style = wx.MAXIMIZE_BOX | wx.RESIZE_BORDER \
| wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX)
window.Show(True)
app.MainLoop()
# if __name__ == '__main__':
| true |
c01a819dc4b72573b9cc6df641e298cfaad52c7d | Python | Literably/theano-rnn-1 | /rnn/lstm.py | UTF-8 | 712 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | """Module that contains functionality for lstm RNNs."""
__author__ = 'Justin Bayer, bayer.justin@googlemail.com'
import theano
import theano.tensor as T
sig = T.nnet.sigmoid
def make_expr(lstminpt, state):
lstminpt_squashed = sig(lstminpt)
slicesize = lstminpt.shape[0] / 4
inpt = lstminpt_squashed[:slicesiz... | true |
a125d13851354e099c720a297854c8bb13a6a8ee | Python | Varun-Nirala/Python | /SomeProject/ReadReelStrips.py | UTF-8 | 435 | 2.84375 | 3 | [] | no_license | import sys
import xml.etree.ElementTree as ET
file_data = open("abc.xml", "r")
str_data = file_data.read()
xml_data = ET.fromstring(str_data)
reelstripdef_list = xml_data.findall("reelstripdef")
for reelstripdef in reelstripdef_list:
stop_list = reelstripdef.findall("stop")
print(reelstripdef.get(... | true |
a1880daa35bd1369b45213bed076c3e993532774 | Python | dimartinot/digital_race_team2005 | /src/classes/CarControl.py | UTF-8 | 4,201 | 2.984375 | 3 | [] | no_license | #! /usr/bin/env python
#-*- coding: utf-8 -*-
import numpy as np
import cv2
import rospy
import std_msgs.msg
import math
steer_publisher = None
speed_publisher = None
laneWidth = 40
minVelocity = 10
maxVelocity = 50
preError = None
kP = None
kI = None
kD = None
t_kP = None
t_kI = None
t_kD = None
carPos = None
... | true |
cfc3bdfcdaff1af4b70516fc89540fdeb30a7a82 | Python | sguna0100/pyGuvi | /perfectSquare.py | UTF-8 | 136 | 3.125 | 3 | [] | no_license | import math
n=int(input(int))
m=int(input(int))
o=m*n
root=math.sqrt(o)
if(int(root+0.5)**2==o):
print("yes")
else:
print("no")
| true |
9835ebcfbc962d1a34a2a822811343d4eb6a27cb | Python | ligaydima/pygame_proj | /db_interaction.py | UTF-8 | 806 | 3.015625 | 3 | [] | no_license | import sqlite3
import constants
class Interactor:
def __init__(self):
self.connection = sqlite3.connect(constants.DB_NAME)
self.cursor = self.connection.cursor()
self.cursor.execute(f"""CREATE TABLE IF NOT EXISTS "{constants.TABLE_NAME}" (
"score" INTEGER,
... | true |
287fbee5a2fba77e3ec0984ea55ce8042574b63c | Python | Annisotropy/Python | /HW2/Task4.py | UTF-8 | 225 | 3.703125 | 4 | [] | no_license | phrase = input('Введите предложение из нескольких слов, разделенных пробелами: ')
words = phrase.split()
print(words)
for i, w in enumerate(words):
print(i, w[0:10])
| true |
b53932bae1a5194efd4f835103c67cc99f5ebc40 | Python | VegaGT/python-city | /outdoors/lake.py | UTF-8 | 556 | 4.1875 | 4 | [] | no_license | def draw_lake(length, width):
"""
Print a lake of given parameters(length and width)
:param length: integer defining the length of a lake
:param width: integer defining the width of a lake
:return:
"""
# Sanitizing parameters
if length < 0:
raise ValueError("Length is negative"... | true |
085fcbb47bac058bf62e0f98d56268ff4d646316 | Python | ruanguoqing/basal-ganglia | /basalganglia/reinforce/util/torch_util.py | UTF-8 | 2,070 | 2.53125 | 3 | [
"Unlicense"
] | permissive | import numpy as np
import torch, torch.autograd as A
from gym.spaces import Box, Discrete
def torchify(y, type=Box):
if type is Box:
return torch.Tensor(y).type(torch.FloatTensor)
elif type is Discrete:
return torch.Tensor(y).type(torch.LongTensor)
def make_indicator(y_tensor, n_dim=None):
... | true |
6b78f05aa70323e2bd8714b5bb296cdf102aab9f | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2579/60668/279235.py | UTF-8 | 865 | 2.578125 | 3 | [] | no_license | def maxSideLength(t,mat=[]):
m,n = len(mat),len(mat[0])
P = [[0]*(n+1) for _ in range(m+1)]
for i in range(1,m+1):
for j in range(1,n+1):
P[i][j] = P[i-1][j] + P[i][j-1]-P[i-1][j-1] +mat[i-1][j-1]
def getR(x1,y1,x2,y2):
return P[x2][y2] - P[x1 - 1][y2] - P[x2][y1 - 1] + P[x1 ... | true |
e48b06a835a23c67a28856eae8db6eeafeed29c8 | Python | Zapunidi/NNMG | /Data/ProcessingCutData.py | UTF-8 | 1,015 | 2.640625 | 3 | [] | no_license | from mido import MidiFile, MidiTrack, Message, tick2second, second2tick
import os
import numpy as np
number_file = 0
delete_file = 0
for root, dirs, files in os.walk("CutData/Classic"):
for file in files:
if (os.path.splitext(file)[1] == ".mid" or os.path.splitext(file)[1] == ".midi"):
number_... | true |
ecba6a609508e2595339a38bd4409bc50971f404 | Python | vta/BLDSify-the-County | /cities/city.py | UTF-8 | 602 | 3 | 3 | [] | no_license | """
City class is a base class for the cities.
Particular city implementation need to define self.fields dictionary that maps the field names
from a city dataset to BLDS standard
- get_value() function can be used for complicated field aggregations
"""
class City:
def __init__(self, name, fields):
self.c... | true |
a1c438d4dcdb773e99c5009eff2b57d7997210bd | Python | xiaojkql/Algorithm-Data-Structure | /Basic Data Structure/Tree/BinaryTree/binNode.py | UTF-8 | 1,531 | 3.53125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
'''
Author: Qin Yuan
E-mail: xiaojkql@163.com
Time: 2019-02-17 21:48:12
'''
# 二叉搜素树的树节点
import random
class BinNode:
def __init__(self, data=None, parent=None,
lc=None, rc=None, h=0):
self._data = data
self._parent = parent
self._lc = lc
s... | true |
6ec6a005824bb97117a6ac34a3fb293c0509e1f6 | Python | Krisly/Scientific_Computing | /Assignment2/code/test_cmp_plt.py | UTF-8 | 1,932 | 2.609375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
xmin = -30
xmax = 30
ymin = -30
ymax = 30
xv, yv = np.meshgrid(np.arange(xmin,xmax,0.05),
np.arange(ymin,ymax,0.05),
sparse=False, indexing='ij')
a = xv + 1j*yv
C = np.zeros(a.shape,dtype=np.float64)
A = np.matrix([[(88-7*np.... | true |
550ec38184e6125d634d5af817d59c815298a61b | Python | CiscoTestAutomation/genielibs | /pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/hsrp/configure.py | UTF-8 | 8,411 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | """Common configure functions for HSRP"""
# Python
import logging
# Unicon
from unicon.core.errors import SubCommandFailure
log = logging.getLogger(__name__)
def configure_interface_vlan_standby_ip(device, vlan_number, group, ip_address):
""" Configures vlan interface standby group IP
Example: standby 0... | true |
63edcd51b5f24926e7ac96c17cbda36fb1563bb1 | Python | Aasthaengg/IBMdataset | /Python_codes/p03721/s344598788.py | UTF-8 | 201 | 2.609375 | 3 | [] | no_license | n, k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
#print(ab)
ab.sort()
#print(ab)
for i in range(n):
k = k-ab[i][1]
if k <= 0:
print(ab[i][0])
exit() | true |
4267d37fe5b4714eec1e1437446a24cdecd2453f | Python | smileyoung1993/Mysite_django | /mysite/urls.py | UTF-8 | 2,032 | 2.515625 | 3 | [] | no_license | """mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | true |
e8c8f73fe98833489cf418d15d6edde53411e18b | Python | xbh/Home-Work-of-MLES | /exercise/U4_loop/day2.py | UTF-8 | 319 | 3.328125 | 3 | [] | no_license | ip = int(input())
position = ip + 65
op = 65
if ip <= 122:
while op < position:
print(chr(op),"", end="")
op = op + 1
else:
print("")
else:
print("F word")
for i in range(1,11):
print(i)
text = "WHAT THE FXXX"
for i in range(len(text)):
print(text[i]) | true |
0ddbe2d9a079189528b11e64e1bf5ec56a25a283 | Python | NilsBergmann/AdventOfCode2017 | /Day1/__main__.py | UTF-8 | 570 | 3.703125 | 4 | [] | no_license |
def solve1(number):
sum = 0
for digit, nextDigit in zip(number, number[1:]):
if digit==nextDigit:
sum += int(digit)
if number[0] == number[-1]:
sum += int(number[0])
print("solve 1:", sum)
def solve2(number):
sum = 0
for index ,digit in enumerate(number):
m... | true |
729ea794f7560d0e7e7550923bac36c0b15c5076 | Python | matt-rowlinson/NCAS_CVAO | /bin/change_in_seasonal.py | UTF-8 | 4,450 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 9 11:33:36 2019
@author: ee11mr
"""
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from datetime import datetime, timedelta
from scipy.interpolate import InterpolatedUnivariateSpline
from pandas import DataFra... | true |
bc3c3fc50cd692f93573e812e0cf62dd6189dc92 | Python | ponnuru171/Python-1 | /online/reverse in arry.py | UTF-8 | 155 | 3.390625 | 3 | [] | no_license | import numpy as np
x=np.array([[1,2,3,4,5,6,7,8,9],[9,8,7,6,5,4,3,2,1]])
print(x)
print("--------------------------------------------1")
y=x[::-1]
print(y) | true |
9b168790796c395f6e3355c7c92c5ae574a651ad | Python | singultek/ModelAndLanguagesForBioInformatics | /Python/List/12.partition.py | UTF-8 | 701 | 4 | 4 | [
"MIT"
] | permissive | def partition(pivot: int, in_list: list)-> (list,list):
"""
taken one list L of integers and one integer value N,
divides the elements of L in two lists L1 and L2
such that all elements less or equal than N are in
L1 and in L2 all the others.
:param pivot: the pivot number
:param in_list... | true |
c97b935e02589b1cdfe5d5610ad2554b8b0842e3 | Python | Aleksandr-QAP/studySF | /17.4.3.py | UTF-8 | 336 | 3.1875 | 3 | [] | no_license | def par_checker(string):
stack = []
for s in string:
if s == "(":
stack.append(s)
elif s == ")":
if len(stack) > 0 and stack[-1] == "(":
stack.pop()
else:
return False
return len(stack) == 0
par_checker((5... | true |
375be2c737113bd6a999e2fd235d2e6192e76e4d | Python | gerirosenberg/python-for-mapping | /intro_to_python/latlon.py | UTF-8 | 1,401 | 4.5 | 4 | [] | no_license | # This program describes a longitude and latitude point.
# Says what the program will help the user do, followed by an empty line
print("This program provides information about a location based on its longitude and latitude.")
print()
# Uses the latitude to determine location details
def latInfo() :
lat = float(i... | true |
7ad0c06cd21fa42d80078d40d3a393a2b54a0a9f | Python | shinmura0/dcase2020_task2_baseline | /keras_model.py | UTF-8 | 1,930 | 2.578125 | 3 | [
"MIT"
] | permissive | """
@file keras_model.py
@brief Script for keras model definition
@author Toshiki Nakamura, Yuki Nikaido, and Yohei Kawaguchi (Hitachi Ltd.)
Copyright (C) 2020 Hitachi, Ltd. All right reserved.
"""
########################################################################
# import python-library
########... | true |
51863767014cc90100ec41114915b283bb013f69 | Python | kongzichixiangjiao/GAFile | /小机智-工作相关/报表生成/Result/result.py | UTF-8 | 2,698 | 2.578125 | 3 | [] | no_license |
import sys
import os
import openpyxl
import time
import_dir = \
os.path.join(os.path.join(os.path.dirname(
__file__), os.pardir), 'Root')
sys.path.insert(0, import_dir)
file_name = 'root'
Root = __import__(file_name)
print(Root.dates)
print(Root.stores)
import_dir1 = \
os.path.join(os.path.join(os.pa... | true |
eeefb09d2081a27cf6ec2bd167cdfe535c859cb9 | Python | moallafatmaocto/FSS-1000 | /tests/data_preprocessing/test_episode_batch_generator.py | UTF-8 | 1,079 | 2.53125 | 3 | [] | no_license | from unittest import TestCase
import torch
from src.data_preprocessing.batch_generator import get_autolabel_batch
class TestBatchGenerator(TestCase):
def test_get_autolabel_batch_returns_the_right_size_for_support_and_query_batch(self):
# Given
testname = '1.jpg'
class_num = 1
s... | true |
72f84eca5292d4cf6a09e6a643a73e24da951e3e | Python | CyHsiung/Recommendation-system | /src/Utils/LR_helper.py | UTF-8 | 8,302 | 2.59375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import os.path as join
from collections import OrderedDict
# drop_pre_thr = 30 # When # of p-edge > drop_pre_thr, the user become candidate of drop
# drop_user_rate = 0.3 # perform delete on these ratio of candidates (candidate / total usesr)
# drop_pre_rate = 0.3 # the ... | true |
5ba7414ecc840d6c8d3114c655f1f74aa112f52f | Python | tuestudy/janggi | /gui/main.py | UTF-8 | 1,049 | 2.546875 | 3 | [] | no_license | # coding: utf-8
import argparse
from tkinter import Tk
from .janggi_board import JanggiBoard
formations = ['left', 'right', 'inside', 'outside']
parser = argparse.ArgumentParser(description='조선장기')
parser.add_argument(
'-a', '--red-formation', choices=formations, type=str,
default='inside', help='초 상차림')
p... | true |
3f9b0da05d85ba867d1d5f8a1cc13bce1f745225 | Python | Ansen/Python_Learn | /oppdemo3.py | UTF-8 | 170 | 2.78125 | 3 | [] | no_license | from oppdemo import Bird
class happyBird(Bird):
def __init__(self, more_words):
print 'We are happy birds.', more_words
summer = happyBird('Happy,Happy!') | true |
63df2f42189a13b676cb06d869bc0a17cd609c69 | Python | Grosbin/python-2021 | /combinaciones.py | UTF-8 | 368 | 3.734375 | 4 | [] | no_license | a = int(input("Enter the first digits"))
b = int(input("Enter the second digits"))
c = int(input("Enter the third digits"))
list = []
list.append(a)
list.append(b)
list.append(c)
for i in range(0, len(list)):
for j in range(0, len(list)):
for k in range(0, len(list)):
if i!=j & j!=k & k!=i:
... | true |
251fbe6b026c2719a68901e31ce32c60144e4d5a | Python | marczuo/LatinTextID | /textmodel.py | UTF-8 | 5,766 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
import subprocess
import string
import re
import json
# Helper functions
class TextModel(object):
"""A model for storing text identification data."""
def __init__(self, name):
"""Keyword arguments:
name -- Identifying name of the text model.
"""
self.name = name
se... | true |
39f52223d78549fb40c0b8856d5cf8250dd73d7f | Python | taliav26/pupila | /viewer.py | UTF-8 | 5,515 | 2.59375 | 3 | [] | no_license | import os
import re
from PySide2.QtCore import QObject, QStringListModel, QUrl, Slot, Signal, Property, QAbstractItemModel
class Viewer(QObject):
def __init__(self):
QObject.__init__(self)
self._selected_file = ""
self._selected_file_folder = ""
self._selected_file_siblings = QStri... | true |
cdb3d62093dbc3d5cfeae48dd4e3aa48801a1792 | Python | hello-starry/MotionExplorer | /scripts/optimalcontrol/Reach.py | UTF-8 | 3,148 | 2.78125 | 3 | [] | no_license | import numpy as np
import scipy.linalg
from scipy.linalg import expm, logm
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
import sys
from scipy.spatial.transform import Rotation
def splitConfig(x):
q = x[:6]
dq = x[6:]
return [q,dq]
def mergeConfig(q, dq):
x = np.zeros(len(q)+len(dq)... | true |
e6dcb47552c5e09cf51741fa81cff1fb79687a32 | Python | emscb/DnFauc | /get_item.py | UTF-8 | 162 | 3 | 3 | [] | no_license | # 아이템 상세 정보 검색
from src.Item import Item
while 1:
name = input('아이템 이름을 입력하세요 : ')
f = Item(name)
f.select()
| true |
c91ebc1ff7fe0a48b24a3730aa7ee803eff1ef0e | Python | jason-padilla/DSFundamentals | /Leetcode/Easy/234E-IsLLPali.py | UTF-8 | 2,081 | 4.34375 | 4 | [] | no_license | '''
Given the head of a singly linked list, return true if it is a palindrome.
Input: head = [1,2,2,1] Input: head = [1,2]
Output: true Output: true
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = ... | true |
2c560e7046c5773cb2eb70cf88b0ad4729c0d13f | Python | markku63/mooc-tira-s20 | /Viikko_4/stacksort.py | UTF-8 | 3,369 | 3.546875 | 4 | [] | no_license | from random import shuffle
def check(t):
if len(t) < 2:
# Yhden elementin lista on aina järjestyksessä
return True
stk1 = []
stk2 = []
result = []
# https://faculty.math.illinois.edu/~west/regs/stacksort.html
for i in t:
while True:
# sijoitetaan tyhjään pin... | true |
b9a120c32b4c452834e77903b6dae837e0126147 | Python | LucasJun/cosmetic_spider | /cosmetic_spider/pipelines.py | UTF-8 | 1,820 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
from scrapy.conf import settings
from datetime import datetime
import time
class CosmeticSpiderPipeline(object... | true |
8e96cccbde1ceac78d484968eae6db74b76c992d | Python | j-lazo/Azteca_marron | /scripts/direccion/MD49_Control.py | UTF-8 | 2,568 | 2.734375 | 3 | [] | no_license |
import numpy as np
import skfuzzy as fuzz
def FuzzControl(error):
x_pos = np.arange(-480, 480, 1)
x_speed = np.arange(0, 255, 1)
# Generate fuzzy membership functions
pos_NB = fuzz.trimf(x_pos, [-480, -360, -240])
pos_NM = fuzz.trimf(x_pos, [-360, -240, -120])
pos_NS = ... | true |
4f615e6fb28f243a271d348db43c0442ae9eb384 | Python | frauHello/flashFloodsPrediction | /build/lib/Tree/draw_tree.py | UTF-8 | 6,823 | 2.65625 | 3 | [] | no_license | """
Uses graphviz to make pretty drawings of an SRPT or SRRF.
"""
import sys, os
from utilities.utils import argparser
try:
import path_test # @UnusedImport
except:
sys.path.append(os.path.abspath('./'))
import pickle
from textwrap import wrap
from itertools import chain
import re
import pydot
import argpar... | true |
058f74d9d2737566f97ba3fcde9853ecb6717433 | Python | ucsb-seclab/dr_checker | /helper_scripts/pp_scripts/pp_jsons.py | UTF-8 | 8,996 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | import argparse
import multiprocessing
import os
import time
import json
import sys
def log_info(*args):
log_str = "[*] "
for curr_a in args:
log_str = log_str + " " + str(curr_a)
print log_str
def log_error(*args):
log_str = "[!] "
for curr_a in args:
log_str = log_str + " " + s... | true |
bbc9c329224152d783b7a87141dbf7d5ce5e1698 | Python | Huaguiyuan/chi | /sort.py | UTF-8 | 1,130 | 3.375 | 3 | [] | no_license | def merge(list1, list2):
"""Takes two lists of bibtex dictionaries and
merges list1 with list2 without redundances."""
rv = list1
IDs = [item['ID'] for item in list1]
titles = [item['title'] for item in list1]
for idx, src in enumerate(list2):
try:
flag_ID = src['ID'] in I... | true |
24fe9ef7bf5854f7b54e56665504da70c735ecd8 | Python | AmitBaanerjee/Data-Structures-Algo-Practise | /leetcode problems/NextGreaterElement.py | UTF-8 | 2,346 | 3.78125 | 4 | [] | no_license | # 496. Next Greater Element I
# You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2.
#
# The Next Greater Number of a number x in nums1 is the first greater number to its rig... | true |
edd3fa4ddfee0eb810050f10116f54465e31a3ba | Python | 150170410/innovativeproject-resttest | /src/indor/command_factory.py | UTF-8 | 798 | 2.8125 | 3 | [
"MIT"
] | permissive | import re
from .indor_exceptions import SyntaxErrorClassNotExists
from .singleton import Singleton
class CommandFactory(object, metaclass=Singleton):
def __init__(self):
self.dict = {}
def add_class(self, class_name, class_type):
self.dict[class_name] = class_type
def get_class(self, pre... | true |
c81256e21d0f3b51e9edcf123bcda9272449071b | Python | n-fallahinia/realtime-force-estimation | /test.py | UTF-8 | 2,900 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | """
Script to evaluate the model using test data
Make sure to run the "build_dataset.py" to creat the data folder
Navid Fallahinia - 07/11/2020
BioRobotics Lab
"""
import argparse
import os
from packaging import version
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from model.input_fn import *
from model.evaluation import... | true |
d161fc779aa65a77d8402cc91cbc8f32eacf9f16 | Python | AndreyATGB/Facebook-Text-Extractor | /src/textExtract_all_onefile.py | UTF-8 | 3,017 | 3.40625 | 3 | [] | no_license | import os, sys, time, random
"""
HTML Facebook log extractor
message starts at <div class="message_header"> with usr who sent it.
messages between <p> and </p>
user between <span class="user"> and </span>
"""
def findMsgs(filename, shuffle=False, debug=False):
startTime = time.time()
# Read in entire file after... | true |
635d1981509fdd4d32ea35ab22a644085cb390bb | Python | mulligatawny/me408-hw5 | /p1.py | UTF-8 | 883 | 3.09375 | 3 | [] | no_license | # 1/4
import numpy as np
import matplotlib.pyplot as plt
N = 32
def error(N):
x = np.linspace(0, 2*np.pi, 10000)
x_N = np.linspace(0, 2*np.pi, N+1)[:-1]
# f = np.abs(np.sin(x))**3
f = 1/(1+2*np.sin(x)**2)
# f_N = np.abs(np.sin(x_N))**3
f_N = 1/(1+2*np.sin(x_N)**2)
k = np.arange(-N/2, N/2)
... | true |
8af9c1b512308f6f9cb530b032331efbeef322ba | Python | mlz000/Algorithms | /leetcode/636.py | UTF-8 | 502 | 2.734375 | 3 | [] | no_license | class Solution(object):
def exclusiveTime(self, N, logs):
ans = [0] * N
s = []
last = 0
for log in logs:
fn, typ, time = log.split(':')
fn, time = int(fn), int(time)
if typ == 'start':
if s:
ans[s[-1]] += time... | true |
a64180e846ddc8bd9ee6d43c9f555afe49fd8c63 | Python | Amel294/amel | /ml/day14/q1b.py | UTF-8 | 818 | 2.828125 | 3 | [] | no_license | def ae(a):
from sklearn.datasets import load_iris
from sklearn.neural_network import MLPClassifier
iris=load_iris()
type(iris)
if a==50:
print('When iter is 50')
elif a==500:
print('Whaen iter is 500')
elif a==1000:
... | true |
82e02954a2aa9fff23f5b5148eb941cf76ba5085 | Python | 17637294588/x_xinxin | /users/serializer.py | UTF-8 | 7,751 | 2.8125 | 3 | [] | no_license | from users import models
from rest_framework import serializers
from django.contrib.auth.hashers import check_password
# 定义序列化器
class userSerializer(serializers.ModelSerializer):
'''
序列化器:
接受的参数就是 request.data
序列化器接受的 data 里面有 password2 这个字段我不需要入库这边只需要判断和第一次密码
是否一致,所以要先为... | true |
8d9fb3c98401a6601504c611b05a862a08dc2866 | Python | ucandoitrohit/Python3 | /Automation/Math_Module_Python/1.math_example.py | UTF-8 | 151 | 3.0625 | 3 | [] | no_license | import math
print(math.pi)
print(math.e)
print(math.degrees(1))
print(math.acos(.5))
print(math.asin(.5))
print(math.exp(2))
print(math.log(10,10))
| true |
0202591ea0cc40ef34be9fa8c89430e7bd0110ed | Python | charliethomson/block_game_old | /include/parser.py | UTF-8 | 8,058 | 3.171875 | 3 | [] | no_license | from os.path import exists as file_exists
from pyglet.window import key as keys
# General parser for my file format
class ParserError(Exception):
pass
class IncorrectGivenDataError(ParserError):
pass
class ParserUnexpectedCharacterError(ParserError):
pass
class UnknownKeycodeError(ParserError):
... | true |
76eb9bcbd973dd86e74786c3874d6a85b0e8040d | Python | Dippimunch/Advent-2020 | /day2.py | UTF-8 | 371 | 3.15625 | 3 | [] | no_license | import re
file = open(r'day2_data.txt', 'r')
passwords = re.findall(r'(\d+)-(\d+)\s(\w):\s(\w+)', file.read())
valid = 0
for i in range(len(passwords)):
valid_check = passwords[i][3].count(passwords[i][2])
if valid_check >= int(passwords[i][0]) and valid_check <= int(passwords[i][1]):
val... | true |
4c84db41fad63e32b4af1629c31c427bad494fa1 | Python | Neuronys/DRL_ColaborationCompetition | /model.py | UTF-8 | 3,212 | 2.9375 | 3 | [] | no_license | # I've reused the model code I've made for project 2
# This is inspired from:
# https://github.com/udacity/deep-reinforcement-learning/blob/55474449a112fa72323f484c4b7a498c8dc84be1/ddpg-bipedal/model.py
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# use for NN weight initiali... | true |
f337379a1fcb8aaf97f14260813bfde457c1a053 | Python | audehamdi/mlproject | /tests/tool_test.py | UTF-8 | 428 | 2.71875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
# Import from standard library
import os
import mlproject
import pandas as pd
# Import from our lib
from mlproject.tools import haversine
import pytest
def test_haversine():
#lat1, lon1 = 48.865070, 2.380009
#Insert your coordinates from google maps here
#lat2, lon2 = 51.527870, -... | true |
4af8bdd42c4c98d0909b105190f93c2b919302c1 | Python | anandgarg91/CodeRozana | /Maclearn/angle_pmu/log_reg.py | UTF-8 | 1,298 | 2.71875 | 3 | [] | no_license | from pandas import read_csv
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import LinearRegression
from sklearn import metrics
from sklearn.model_selection import train_test_split
import matplotl... | true |
9f4b0f35571b2d2e26a828f14b61ffce5ea1186c | Python | Apu66/Machine-Learning-Line-Follower | /learning/format.py | UTF-8 | 6,295 | 3.09375 | 3 | [] | no_license | import time
import json
import pandas as pd
"""
Helper file which provides methods for
formatting the raw sensor data
"""
"""
load a dataset
"""
def load( dataset ):
with open('/Users/samnockels/projects/dissertation/data/'+dataset+'.json', 'r') as f:
data = json.load(f)
return data
"""... | true |
7f0f66410133136707d71e99d19bc7bc6c5702bd | Python | aladdinpersson/Machine-Learning-Collection | /ML/Pytorch/Basics/pytorch_rnn_gru_lstm.py | UTF-8 | 5,524 | 3.296875 | 3 | [
"MIT"
] | permissive | """
Example code of a simple RNN, GRU, LSTM on the MNIST dataset.
Programmed by Aladdin Persson <aladdin.persson at hotmail dot com>
* 2020-05-09 Initial coding
* 2022-12-16 Updated with more detailed comments, docstrings to functions, and checked code still functions as intended.
"""
# Imports
import torch
im... | true |
78a64fd6315dfa7c80d27997473dc0f8e1594842 | Python | SCaicedo99/Sorting-Algorithms | /insertionSort.py | UTF-8 | 414 | 4.3125 | 4 | [] | no_license | # This sorting algorithm sorts the given array from highest to lowest, its running time is o(n^2),
def insertionSort(alist):
for index in range(1,len(alist)):
currentvalue = alist[index]
position = index
while position>0 and alist[position-1]>currentvalue:
position = position-1
alist[... | true |
5045621bacc64bb1fcf97362fd208e2855d0109b | Python | AidenSmith09/Python | /Day17_File_and_exception/alice.py | UTF-8 | 766 | 3.421875 | 3 | [] | no_license | # /bin/etc/env Python
# -*- coding: utf-8 -*-
filename2 = "alice2.txt"
try:
with open(filename2) as f_obj:
contents2 = f_obj.read()
except FileNotFoundError:
print("没有" + filename2 + "文件")
def count_words(filename):
try:
with open(filename) as file_obj:
contents = file_obj.rea... | true |
d02b6d551607e63e489c991105ce9ada9cfbee62 | Python | yunsseong/Make_Python_Game | /Make_Python_Game/Dig_Mines_And_Save_Lives/Dig_Mines_And_Save_Lives.py | UTF-8 | 8,185 | 2.90625 | 3 | [] | no_license | #지뢰찾기 게임
import random
import copy
import sys
global GAME_MODE
GAME_MODE = "DEBUG"
# 게임에 추가되면 좋을 것 같은 기능
# 이전으로 한턴 돌리기 기능(UNDO)
# 로그인 기능
# 게임 이어하기
#역할 : 맵을 터미널에 출력하는 함수
def print_map(*map_obj):
if GAME_MODE == "NOMAL":
for i in map_obj:
for j in i:
print(j, end = " ")
... | true |
29bf8382a08807f2f535c82184744eab7d9795e5 | Python | SacredArrow/Secondary_structure_public | /Scripts/counter.py | UTF-8 | 197 | 3.28125 | 3 | [] | no_license | #counts number of sequences in File
import sys
file = sys.argv[1]
f = open(file, "r")
cnt = 0
for line in f:
if line[0] == "#": # 3 lines with "#" per sequence
cnt+=1
print(cnt, cnt/3)
| true |
df6263b8f433ff07e06e4ff33862b339746bcdff | Python | sravanrao2/python_coding | /tictactoeFinal.py | UTF-8 | 4,563 | 2.9375 | 3 | [] | no_license | from tkinter import *
import tkinter.messagebox
ttt = Tk()
ttt.title("Tic Tac Toe Game")
plyrx = StringVar()
plyry = StringVar()
bclk = True
count = 0
def disableBtn():
button1.configure(state=DISABLED)
button2.configure(state=DISABLED)
button3.configure(state=DISABLED)
button4.configure(state=DISA... | true |
12860f4dae95a35bcdc1acecc2668d63ecffe8bc | Python | lemaoliu/LeetCode_Python_Accepted | /121_Best_Time_to_Buy_and_Sell_Stock.py | UTF-8 | 449 | 3.359375 | 3 | [] | no_license | # 2015-03-30 Runtime: 97 ms
class Solution:
# @param prices, a list of integer
# @return an integer
def maxProfit(self, prices):
# find the max diff, the larger number must come after the smaller number
if not prices:
return 0
minPrice, diff = 10**10, -10**10
fo... | true |
da1e0dfa801e2550370fb286bfe3ee69889df2c8 | Python | santhoshbabu4546/GUVI-9 | /Player/set13/del_string.py | UTF-8 | 104 | 2.984375 | 3 | [] | no_license | a1 = input().split()
a2 = input().split()
for i in a2:
a1.remove(i)
print(' '.join(map(str,a1)))
| true |
74cc92d001468450218d75667bf79ee7fd8781b7 | Python | vlad988/Day1 | /15.py | UTF-8 | 321 | 3.140625 | 3 | [] | no_license | a = int(input('Введіть ціле число '))
suma =(a*(a+1))/2
print(suma)
import datetime
def printTimeStamp(name):
print('Автор програми:Негоденко ' + name)
print('Час компіляції: ' + str(datetime.datetime.now()))
printTimeStamp('Nehodenko and Neskoromny')
| true |