blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
d74c74cd6ae4d0ede84939fe09ef052da9940e42 | lixiang2017/leetcode | /problems/1647.0_Minimum_Deletions_to_Make_Character_Frequencies_Unique.py | UTF-8 | 601 | 3.328125 | 3 | [] | no_license | '''
Runtime: 192 ms, faster than 69.70% of Python3 online submissions for Minimum Deletions to Make Character Frequencies Unique.
Memory Usage: 14.8 MB, less than 51.90% of Python3 online submissions for Minimum Deletions to Make Character Frequencies Unique.
'''
class Solution:
def minDeletions(self, s: str) -> in... | true |
35ffc6826ad586a837ada26196332f56d40139ee | ryanofarrell/ncaa-basketball | /code/dbLoad/vegasDataExplore.py | UTF-8 | 3,596 | 2.671875 | 3 | [
"MIT"
] | permissive |
#%%
import pandas as pd
import numpy as np
from datetime import timedelta
# Import to add project folder to sys path
import sys
utils_path = '/Users/Ryan/Documents/projects/ncaa-basketball/code/utils'
if utils_path not in sys.path:
sys.path.append(utils_path)
from db import get_db
from api import getSeasonsList... | true |
e00ec2ea4c831002191935d2ff60803864b43bf5 | usoderst/Dancing_Links | /Dancing_Links_Network.py | UTF-8 | 27,470 | 2.96875 | 3 | [] | no_license |
# coding: utf-8
# In[131]:
import numpy as np
from math import sqrt,ceil,pow
from time import time
import collections
import random
import os
###############################
#Define Non-Class Methods
###############################
def GenQue(QueFilename,Nkeys,path):
keyque = []
Data_File = open(pathQues +... | true |
48f60e734e1714da33b10fa20cb618e8699f8616 | podhmo/block.komet | /tests/block/komet/test_folding.py | UTF-8 | 585 | 2.984375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import unittest
class FlattenFoldingTests(unittest.TestCase):
def _callFUT(self, *args, **kwargs):
from block.komet.folding import flatten_folding
return flatten_folding(*args, **kwargs)
def test_it(self):
xs = zip(["a", "b", "c", "d"], range(5))
store = ... | true |
b1e0ecd79f1297eef48bf00425c18fb17dacf54f | raj10071997/ConvolutionalNeuralNetwork | /Module1part1.py | UTF-8 | 1,525 | 2.953125 | 3 | [] | no_license | import pickle
import numpy as np
from NearestNeighbourClass import NearestNeighbour, KNearestNeighbour
train_dic={}
train_data=[]
train_labels=[]
test_dic={}
test_data=[]
test_labels=[]
for i in range(1,6):
file = "data_batch_%d" % i
with open(file,'rb') as fo:
train_dic[file] = pickle.load(fo, encoding='latin1'... | true |
3afa176a97dcb1a19897575dd511aeda78d0f3ec | dsenturk25/AUV-Dashboard | /src/main.py | UTF-8 | 4,983 | 2.53125 | 3 | [
"MIT"
] | permissive |
import sys
import os
import cv2
import tkinter as tk
import tkinter.font as font
from PIL import Image
from PIL import ImageTk
from tkinter import messagebox
import numpy as np
root = tk.Tk()
root.resizable(0, 0)
root.title("Tigers Robotics ROV Dashboard")
canvas = tk.Canvas(root, width=1000, height=700)
canvas.pac... | true |
722a711f01c0b67ea4db8e621dadb511f7d138b2 | alvinwang922/Data-Structures-and-Algorithms | /TwoPointers/Lower-Subarray-Product.py | UTF-8 | 764 | 4.09375 | 4 | [] | no_license | """
Your are given an array of positive integers nums.
Count and print the number of (contiguous) subarrays where the
product of all the elements in the subarray is less than k.
"""
class Solution:
def numSubarrayProductLessThanK(self, nums: List[int], k: int):
left, curr, ans = 0, 1, 0
for right... | true |
b6b13ce8bb8806e20256dd39b856a4018627961f | vit0r/clean-architecture-api-restplus-flask | /core/repository/base_repository.py | UTF-8 | 1,863 | 2.859375 | 3 | [] | no_license | """
This Module Provides Basic Repository Functionality
"""
from core.startup import DB
from sqlalchemy.exc import SQLAlchemyError
from . import AbstractBaseRepository
class BaseRepository(AbstractBaseRepository):
"""
Base Repository Class with Basic methods which Book repository will inherit from.
"""
... | true |
3068c2e452b1ff43cb03f9d74409f063ab7cfd04 | OZ-T/002_design_patterns | /behavioral/command.py | UTF-8 | 2,591 | 3.375 | 3 | [] | no_license | from abc import ABC, abstractmethod
class Command(ABC):
@abstractmethod
def execute(self):
"""
Делегирует полученную команду на исполнение получателю (исполнителю).
"""
pass
class Programmer:
def write_code(self):
print('Программист напишет код.')
def fix_bug(... | true |
4ad4373e15a09d379f70d0e9efd517fd040d3152 | HuShuangPing/Study | /day04/生成器.py | UTF-8 | 1,368 | 4.125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:HuShuangPing
#生成器generator
# 只有在调用时才会生成响应的数据
# 生成器只保存当前的数据,不能往前查看数据
# 但可以往后加载数据,即,c.__next__()
#功能:通过生成器实现并行的效果
#推算的算法复杂,可以用函数来写生成器
def fib(max):
n, a, b = 0, 0, 1
while n < max:
#print(b)
yield b #报存了... | true |
0b2d0329ad824b12751292fdaa00c8747233d666 | AkashBaidya/Artificial-Intelligence | /Algorithms/SolveTSPAllPermutations/SolveTSPAllPermutations.py | UTF-8 | 1,927 | 3.21875 | 3 | [
"MIT"
] | permissive | #==============================================================================
#description : Solves travelling salesman problem by generating all possible states
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes :
#python_version : 3.5.0
#Reference : http... | true |
d1dda1033edd80b6353ac5e9b83a77d946be6f95 | tmpethick/ensembled-dngo | /src/models/models.py | UTF-8 | 9,452 | 2.703125 | 3 | [] | no_license | from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
from src.models.regression import BayesianLinearRegression, GPyRegression
from src.normalization import zero_mean_unit_var_normalization, zero_mean_unit_var_unnormalization
class BaseModel(object):
def get_incumbent(self):
i = ... | true |
6729abdece5a526a4874e57e66eb26d1eaf1faac | DominikKossinski/Obrazy | /obrazy.py | UTF-8 | 21,119 | 2.59375 | 3 | [] | no_license | import os
import random
import time
import cv2
import numpy as np
from skimage import morphology
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier
def area(element):
return cv2.contourArea(element)
def simple_detection(path, file_name):
t = 4
picture ... | true |
3032b1e5a751572487772fff9f94efd00d07aca1 | espressif/esp-adf | /micropython_adf/examples/connect.py | UTF-8 | 657 | 2.578125 | 3 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | # boot.py - network and system path setting
#
# This code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
#
import netw... | true |
e9f7c8613f329c3184a7ff7b254ed72fd8dad55a | skahuria/python101 | /threadExample3.py | UTF-8 | 243 | 3.421875 | 3 | [] | no_license | from threading import *
class Demo:
def show(self):
for i in range(5):
print("This is the child thread")
obj = Demo()
t = Thread(target=obj.show())
t.start()
for i in range(5):
print("This is the parent thread") | true |
b4e6c22b4060038e09b95a5a144919920c87f303 | KIMBEOBWOO/python-baekjoon | /baekjoon/step-1/p10869.py | UTF-8 | 172 | 3.5625 | 4 | [] | no_license | # 두 정수 A와 B를 입력받은 다음,
# 사칙연산 및 나머지 출력
A, B = map(int, input().split())
print(A+B)
print(A-B)
print(A*B)
print(A//B)
print(A % B)
| true |
b1a558f0a224a93f3c957fbc2dbfbc18ec57a3b1 | Halerfermatqing/Python_learning_freshman | /pycharm_projects/binary_transform.py | UTF-8 | 128 | 3 | 3 | [] | no_license | num = 89
print(bin(num))
help(bin)
num2 = 0b01010010111
print(int(num2))
num3 = 0x18938abc
print(int(num3))
print(3^2
) | true |
3171c13f2f54b0b76cfb0b16c81ab647edd6ccb3 | boker123/planewars | /bullet.py | UTF-8 | 867 | 3.40625 | 3 | [] | no_license | import pygame
from pygame.sprite import Sprite
from pygame.sprite import Group
class Bullet(Sprite):
"""一个飞船发射的子弹进行管理"""
def __init__(self,xz_settings,screen,plane):
"""在飞船位置创建一个子弹对象"""
super(Bullet,self).__init__()
self.screen = screen
# 创建子弹并设置其位置
self.image = pygame... | true |
f51867c5a06d5fe308d8f391731650d61dc34a1f | szajakubiak/CircuitPython-Game-of-Life | /code.py | UTF-8 | 4,778 | 3.234375 | 3 | [
"MIT"
] | permissive | import board
import displayio
import random
from time import sleep
# Options
ROUND_WORLD = True # if True object can move around edges, if False edge is treated as an empty cell
USE_USER_SEED = False # if True USER_SEED will be used to settle cells on world map, if False random seed will be generated
USER_SEED = 5... | true |
426d7af96ac94328b5cc8eb3e4c8dd703b2a363f | Fly365/py-learn | /spider_learn/spider_learn01/extract_learn/json01_opt.py | UTF-8 | 689 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import json
strList = '[1,2,3,4,5]'
# Expecting property name enclosed in double quotes 要用双引号
strDict = '{"city":"北京", "name":"fly"}'
json.loads(strList)
json.loads(strDict)
# 编码识别模块
import chardet
listStr = [1,2,3,4]
tupleStr = (1,2,3,4)
dictStr = {"city":"上海","name":"fly"}
json.dumps(lis... | true |
5392a0f27bf543bba5351547a2d49891f6c7289b | crenault73/training | /python/tutograven/src/03_conditions/cre_conditions_cinema.py | UTF-8 | 541 | 4.0625 | 4 | [] | no_license | import string
# Place de cinema
prix = 0
# Récolter de la personne
age = int(input("Quel est votre âge?"))
# Si la personne est mineur -> 7€
if age < 18:
prix += 7
# Si la personne est majeur -> 12€
else:
prix += 12
# Souhaitez-vous du popcorn ?
answer = (input("Souhaitez-vous du popcorn ?")).lower()
popcorn... | true |
a218e7b27678044b5aa79b83ff801bd17e20fd41 | mkowalski/python-advanced-course-cern | /properties.py | UTF-8 | 414 | 3.296875 | 3 | [] | no_license | class Rect:
def __init__(self, w, h):
self.w = w
self.h = h
# self.a = w*h
@property
def a(self):
return self.w * self.h
@a.setter
def a(self, new):
self.w = new / self.h
r = Rect(2, 3)
assert r.w == 2
assert r.h == 3
assert r.a == 6
r.w = 4
assert r.w =... | true |
9966fad0ecb633bc0071dda6f10ecc001420892a | sekenned/climate-news-metrics | /utils.py | UTF-8 | 1,067 | 3.015625 | 3 | [] | no_license | import json
import yaml
from pathlib import Path
def read_config(config_file: str = ".config.yaml") -> dict:
"""
input file path to secrets.yaml file
parse the file
output the resulting dictionary
"""
with open(config_file, "r") as f:
try:
return yaml.safe_load(f)
... | true |
cb7bda0ded0556308c8666da153653f0d924efbb | pearsonlab/bio_motion_task | /Previous Python Scripts/bio_motion_movie_fixer.py | UTF-8 | 2,914 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D
import argparse
def import_file(filename):
name = pd.read_csv(filename,
delim_whitespace=True, skiprows=[0], encoding... | true |
bd7096fb080c309041fb2a088247041b27cb2276 | transcript/subsystems | /fig_swapper.py | UTF-8 | 3,296 | 2.921875 | 3 | [] | no_license | #!/usr/lib/python2.7
# fig_swapper.py
# purpose: take the fig IDs from the DIAMOND subsystems results and get more info, so I can parse it into categories
import sys, time, re
try:
fig_dic_file = open(sys.argv[1], "r")
infile_name = sys.argv[2]
role_name = sys.argv[3]
hierarchy_name = sys.argv[4]
except IndexEr... | true |
daadef4fa8fb3394407335b23d4b2eccc5874827 | SaloniRawat/Connect4 | /simulateGame.py | UTF-8 | 1,378 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 5 15:49:22 2019
@author: Saloni Rawat
"""
##
##
#Code from the following link
#https://www3.nd.edu/~pbui/teaching/cdt.30010.fa16/project01.html
##
##
# Globals
import play
import connect4
Players = (connect4.PIECE_ONE, connect4.PIECE_TWO)
History = []
... | true |
1cb081035b7f3a67cc162490706c992c7da886e6 | SourDumplings/CodeSolutions | /OJ practices/牛客网:PAT真题练兵场-乙级/在霍格沃茨找零钱.py | UTF-8 | 849 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-11-23 18:39:59
# @Author : 酸饺子 (changzheng300@foxmail.com)
# @Link : https://github.com/SourDumplings
# @Version : $Id$
'''
https://www.nowcoder.com/pat/6/problem/4063
'''
def main():
temp = input()
y = temp.split(' ')[0]
# print(y)
... | true |
8d9896fe79f314e583e73c86b1bcd435b3cd3776 | Doublelucker/musicgeneration | /scripts/model_train.py | UTF-8 | 4,084 | 2.515625 | 3 | [] | no_license | from music21 import converter, instrument, note, chord
import glob
import numpy
import os
from keras.utils import np_utils
from keras.layers import LSTM, Dense, Dropout, Activation
from keras.models import Sequential
from keras.callbacks import ModelCheckpoint
import pickle
import click
@click.command(name='visualize... | true |
63dfc7fa44d77de9810d471e4953c8b45affb224 | AlexNedyalkov/Numerical-methods-Python | /roots_high_degree_equations/secant_method.py | UTF-8 | 795 | 4.46875 | 4 | [] | no_license | '''
Method: Secant
Section: Roots of High-Degree Equations
Course: Programming Numerical Methods in Python
Date: Jan. 15, 2021
'''
from math import cos
def secant(fn, x1, x2, tol=0.000001, maxiter=100):
for iteration in range(maxiter):
x_new = x2 - (x2 - x1) / (fn(x2) - fn(x1)) * fn(x2)
if abs(x_n... | true |
561a3acc56f97dcd8dd4d115c9a35a55b71626e3 | Yusuf-bek/Login-Password | /logpasscode.py | UTF-8 | 7,737 | 3.296875 | 3 | [] | no_license | import os
import mysql.connector
mydb = mysql.connector.connect(
host='localhost',
database='user__data',
user='Abdulaziz',
password='123123123',
)
mycursor = mydb.cursor()
class Login_password:
def __init__(self):
self.username = None
self.login = None
self.password = No... | true |
697f910a8153132fc4238ee8fc17ee42a919fb36 | ar90n/shopee-product-matching | /src/shopee_product_matching/network.py | UTF-8 | 631 | 2.796875 | 3 | [] | no_license | import torch.nn as nn
from torch import Tensor
class AffineHead(nn.Module):
def __init__(self, in_dim: int, out_dim: int = 512, dropout: float = 0.0) -> None:
super().__init__()
self.dropout = nn.Dropout(p=dropout)
self.fc = nn.Linear(in_dim, out_dim)
self.bn = nn.BatchNorm1d(out_d... | true |
79cdf76c80c9427eff6fec5ea164cfdce0fd8df0 | ericguang/Python001-class01 | /week02/spiders/spiders/mysql_do.py | UTF-8 | 1,617 | 2.6875 | 3 | [] | no_license | import pymysql
def insert_movie(name, time, category):
conn = pymysql.connect(
host="127.0.0.1",
user="root",
password="root",
db="scrapydb",
charset="utf8mb4",
cursorclass=pymysql.cursors.DictCursor,
)
try:
with conn:
sql = "insert into `... | true |
1b52bc5e96ca856cb72ce3daca8f642dcd6e28e0 | unsortedtosorted/elgoog | /medium/BFS/**numSquares.py | UTF-8 | 1,050 | 3.265625 | 3 | [] | no_license | """
#279. Perfect Squares
"""
from collections import deque
class Solution(object):
def numSquares(self, n):
"""
:type n: int
:rtype: int
"""
powers =[]
i = 1
while i*i<=n:
powers.append(i*i)
i+=1
... | true |
3d45786dcbcba8995d1277f6849e860da1f3ca87 | JustinTChen/PythonPoker | /Deck.py | UTF-8 | 673 | 3.359375 | 3 | [] | no_license | from datascience import *
import numpy as np
StandardDeck = Table.read_table("Deck.csv")
#Deck class, with card subclasses
class Deck:
count = 52 #keeps track of number of cards in the deck
used, unused = [], [] #keeps track of used and unused cards each round
def __init__(self):
self.deck = Stan... | true |
de92ef7ef6819f2944b3b82ec25ae2282adbf0c7 | togarobaja/Togar-Obaja-Nainggolan_I0320103_Tiffany-Bella-Nagari_Tugas-7 | /Exercise 7.37.py | UTF-8 | 96 | 3.1875 | 3 | [] | no_license | a = [10, 40, 30, 10, 70, 40]
print("a awal= ", a)
a.sort()
print("a sesudah di urutkan= ", a) | true |
cad6fa4752194f7b2d973ce23144ac3032ca7505 | zxj5470/learn | /python/mofan-python/com/github/zxj5470/numpy/np_21.py | UTF-8 | 397 | 3.5 | 4 | [] | no_license | import numpy as np
arr = np.array([[1, 23, 4]], dtype=np.int32)
print(arr)
print('number of dim: ', arr.ndim)
print('shape: ', arr.shape) # (1,3) 一行三列
print(arr.dtype)
# 生成 3x4 的 0 矩阵
zrs = np.zeros((3, 4), dtype=np.int32)
a = np.arange(12)
print(zrs)
print(a.reshape((3, 4)))
# line space.生成五个点。四个间隔。
a = np.linsp... | true |
7439903ca0206093b1d7720ecd83ca9a61086926 | damonkelley/pattern-matcher | /pattern_matcher/patterns.py | UTF-8 | 5,223 | 3.984375 | 4 | [
"MIT"
] | permissive | class Node(object):
"""A single node from a pattern.
Here, a node is defined as one character or group characters that
is a member of a comma seperated pattern. For example, given the
pattern,
foo,*,bar
`foo` would be the first node of the pattern.
"""
WILDCARD = '*'
def __in... | true |
2eed21ea75d89c9e519896edfa43a90ddb1aeb90 | mrajancsr/Algorithms | /oop/hr.py | UTF-8 | 731 | 3.828125 | 4 | [] | no_license | """Processes company's payroll"""
class PayrollSystem:
def calculate_payroll(self, employees):
print("Calculating Payroll")
print("====================")
for employee in employees:
print(f'Payroll for: {employee.id} - {employee.name}')
print(f'- Check amount: {employ... | true |
8c3f76fc23e8d78667fa73013622b707f0082337 | geneeol/baekjoon-online-judge | /2100~2199/2161.py | UTF-8 | 1,476 | 4.1875 | 4 | [] | no_license | # 문제
# N장의 카드가 있다. 각각의 카드는 차례로 1부터 N까지의 번호가 붙어 있으며,
# 1번 카드가 제일 위에, N번 카드가 제일 아래인 상태로 순서대로 카드가 놓여 있다.
# 이제 다음과 같은 동작을 카드가 한 장 남을 때까지 반복하게 된다.
# 우선, 제일 위에 있는 카드를 바닥에 버린다.
# 그 다음, 제일 위에 있는 카드를 제일 아래에 있는 카드 밑으로 옮긴다.
# 예를 들어 N=4인 경우를 생각해 보자. 카드는 제일 위에서부터 1234 의 순서로 놓여있다. 1
# 을 버리면 234가 남는다. 여기서 2를 제일 아래로 옮기면 342가 된다.
# 3을 ... | true |
27d91056968b076759f1638467773c201aa37229 | noozip2241993/learning-python | /csulb-is-601/homework/ch09/Ex923.py | UTF-8 | 755 | 2.765625 | 3 | [] | no_license | '''
A large on-demand, video streaming company is designing a large-scale survey
to determine the mean amount of time corporate executives watch on-demand
television. A small pilot survey of 10 executives indicated that the mean time
per week is 12 hours, with a standard deviation of 3 hours. The estimate of the
me... | true |
1ffcc7102b4d5c9985916b3ad3f4338a4b7b8c3a | beOk91/code_up | /code_up1476_1.py | UTF-8 | 436 | 3.3125 | 3 | [] | no_license | n,m=map(int,input().strip().split())
arr=[[0]*m for i in range(n)]
number,x,y,start_x,start_y=0,0,0,0,0
while number!=n*m:
if y==n:
start_y-=1
y=start_y
start_x+=1
x=start_x
number+=1
arr[y][x]=number
x+=1
y-=1
if y<0 or x==m:
start_y+=1
y=st... | true |
27fa3b16b2375ce39893032ef0d19c677a15963c | hsumerf/finance | /url.py | UTF-8 | 1,631 | 3.265625 | 3 | [] | no_license | import urllib.request
import urllib.parse
# 1st tutorial
# x = urllib.request.urlopen('https://www.google.com/')# url for request
# print(x.read()) #this will read all data in url page
#2nd tutorial
# url = 'https://www.utopia.pk/search' #url to access
# values = {'q' : 'python programming tutorials'}
# data = url... | true |
97c2caee8c20c035e3922af61ee882395a8070ac | kartikxisk/python_program | /second_runnerup.py | UTF-8 | 393 | 3.84375 | 4 | [] | no_license |
def get_data():
number = []
n = int(input('Enter the number term:'))
for i in range(n):
output = input(f'Enter the {i+1} number: ')
number.append(output)
return number
def second_runnerup(output):
output.remove(max(output))
return print(f'The runnerup is: {max(outp... | true |
7a240e2a411ae3ae707f2be753d2f36052d79af3 | AdrianStrugala/-Training-AI | /podstawowe_operacje.py | UTF-8 | 748 | 3.515625 | 4 | [] | no_license | import numpy as np
# numpy - statystyka, obliczenia numeryczne
# pandas - in memory database
# sklearn - tradycyjne algorytmy ML
#sieci neuronowe:
# pytorch
# keras
# tensorflow
v1 = np.array([1, 3, 5])
v2 = np.array([4, -3, -1])
#Iloczyn skalarny
print(np.dot(v1, v2))
#Dlugosc wektora
print(np.linalg.norm([1,1])... | true |
da69c4d9f2234a3b5c25eedb3156f6aeac3ed399 | cyrilp83/pydiapo | /pydiapo.py | UTF-8 | 1,016 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import tkinter as Tk
import glob
import time
from PIL import ImageTk, Image
root = Tk.Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.overrideredirect(1)
root.geometry("%dx%d+0+0" % (w, h))
listeimage = []
j = 0
lbl = Tk.Label(root)
def souris(event):
c... | true |
efe047a6a3d045fd8b5599d3155bd9627e540e29 | Jasperswaagman/adventofcode2016 | /day1/part1.py | UTF-8 | 1,230 | 3.8125 | 4 | [] | no_license | import re
# Get our input
f = open('input', 'r')
input_file = f.read().split(', ')
input_file[-1] = input_file[-1].strip()
coords = {'x': 0, 'y':0}
direction = 0
locations = []
# Direction control
# 0 = North
# 1 = East
# 2 = South
# 3 = West
def direction_control(orientation, steps):
# See if we've visited this... | true |
a3ab4d48d33df91cfeaf996d1e2fd6dc4580b2f5 | Sheyper87/stepik-auto-tests-course | /lesson8_step8.py | UTF-8 | 896 | 2.734375 | 3 | [] | no_license | from selenium import webdriver
import time
import math
from selenium.webdriver.support.ui import Select
import os
link = "http://suninjuly.github.io/file_input.html"
browser = webdriver.Chrome()
browser.get(link)
input1 = browser.find_element_by_name('firstname')
input1.send_keys("Ivan")
input2 = browser.find_ele... | true |
e46b4e3475bd919eaf4dc73eff83c87498dec9f1 | FranciscoRodRam/MyST | /Notas_Python/Notas_RepasoPython/ejercicio.py | UTF-8 | 1,561 | 2.578125 | 3 | [
"MIT"
] | permissive |
# -- ------------------------------------------------------------------------------------ -- #
# -- Proyecto: Describir brevemente el proyecto en general -- #
# -- Codigo: RepasoPython.py - describir brevemente el codigo -- #
# -- Repositorio: https://github.c... | true |
d455483e9b05e487b78550793df7d21dd7e3c7ad | rtay2/qbb2016-answers | /week5/04-automate.py | UTF-8 | 211 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
the_heads = []
file = open(sys.argv[1])
first = file.readline()
column_headers = first.rstrip().split('\t')
for i in column_headers:
the_heads.append(i)
print the_heads
| true |
10b9d3890ddffb5ba4ff57fb12fb0aceac664299 | Momin-C/Python-Course | /Data Types/BytesAndArrays.py | UTF-8 | 127 | 3.078125 | 3 | [] | no_license | lst = [20,30,40,234]
print (type(lst))
b=bytes(lst)
print (type(b))
b1 = bytearray(lst)
print(type(b1))
b1[2] = 33
print (b1)
| true |
efb63ebc564d1754e8fdf4c25ce284b8f136c13c | Renhua1991/yelp-academic-dataset | /jsonToCsv.py | UTF-8 | 602 | 3.296875 | 3 | [] | no_license | import json
#define a function
def convert(x):
#convert a json string to a python dictionary
ob=json.loads(x)
#parse nested json item such as "categories"
for k,v in ob.items():
if isinstance(v,list):
ob[k]='-'.join(v)
elif isinstance(v,dict):
for kk,vv in v.items():
ob['%s_%s' % (k,vv)]=vv
del o... | true |
ee86640092e23adc58d0e1d1b50b3ba7828c1f24 | bishii/QA_Scripts | /IoT/RaspberryPi/messing_around/singleLed.py | UTF-8 | 409 | 2.765625 | 3 | [] | no_license | import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
#Red LED 1
GPIO.setup(8, GPIO.OUT, initial=GPIO.LOW)
# Button
GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
#Buzzer
GPIO.setup(12, GPIO.OUT, initial=GPIO.HIGH)
while True:
if GPIO.input(10) == GPIO.HIGH:
GPIO.output(8, GPIO.HIGH)
G... | true |
fcbae5a4a4c4510110a9ad250591c51859b19e62 | aniketsharma00411/introduction-to-robotics-assignment-2 | /coordinate_transformation.py | UTF-8 | 7,730 | 4.375 | 4 | [] | no_license | """
Submission for Assignment 2 of Introduction to Robotics (BCCS-9402) course
Submitted by: Aniket Sharma (2019BCS-008)
Problem statement:
Write a program to transform frame A to frame B, then input position of a point in a frame and output position of the same point in another frame.
INPUT:
It takes 8 values from... | true |
1241a834da9c8bf12db02d15b003ac741774fedd | CodyBuilder-dev/Algorithm-Coding-Test | /problems/programmers/lv2/pgs-42586.py | UTF-8 | 995 | 3.515625 | 4 | [] | no_license | """
아이디어 :
1. 리스트를 돌면서, 최소 배포일자를 계산한다
2. 길이 100짜리 배열에, 각 일자별 배포가능 개수를 집허넣는다
3. 마지막에 해당 리스트를 출력한다
개선안 :
math.ceil을 안 쓰고 하는 방법은?
->음수를 쓰면 된..다... 누군진 모르지만 천재아닌가?
"""
import math
def solution(progresses, speeds):
baePo = [0] * 100
minimumGongsu = [] # 각 job별 최소공수
for idx, currentRate in enumerate(pro... | true |
c961dbc1c308941f22357a31c4de8441dab580a2 | elonmsk/The-survivor | /vraijeu/comet_event.py | UTF-8 | 1,770 | 3.390625 | 3 | [] | no_license | import pygame
from comet import Comet
#créer une classe pour gérer cet evenement
class CometFallEvent:
#lors du chargement => creer un compteur
def __init__(self, game):
self.percent = 0
self.percent_speed = 10
self.game = game
self.fall_mode = True
#definir un group... | true |
71acc662ef6b2cd76be7e53f9bbdd63cbecfb412 | dystudio/django-pgclone | /pgclone/database.py | UTF-8 | 1,142 | 2.75 | 3 | [] | no_license | import copy
from django.conf import settings
def get_default_config():
# Deep copy to ensure the caller doesn't modify this django setting
return copy.deepcopy(settings.DATABASES['default'])
def make_config(db_name):
"""Returns a DB config dict for the database named "db_name"
Also ensures that no... | true |
b30e73a1bad67076d681e708c6066914bdbce2b8 | littlejiumi/leetcode | /字符串/819. 最常见的单词.py | UTF-8 | 347 | 2.828125 | 3 | [] | no_license | class Solution:
def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:
words = [word for word in re.findall(r'\w+',paragraph.lower())]
word_map = sorted(Counter(words).items(), key=lambda x: x[1], reverse = True)
for word, _ in word_map:
if word not in set(banned):
... | true |
9be7bfeedccadd175f82281a464d8f2ab122540b | MightyCrane/Graph_learning | /deep_walk/model.py | UTF-8 | 2,003 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
==================================================
File Name: deep_walk.py
email: songdongdong@weidian.com
Author : songdongdong
date: 2021/3/8 11:27
Description : deepwalk https://arxiv.org/pdf/1403.6652.pdf
https://github.com/sjyttkl/recbyhand... | true |
db6f2457f66a8d486f5397093b68d9e196e586b3 | jbnicolai/code-eval | /99/main.py | UTF-8 | 318 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
import fileinput
import math
for line in fileinput.input():
line = line.strip().strip('(').strip(')')
p1, p2 = line.split(') (')
x1, y1 = p1.split(', ')
x2, y2 = p2.split(', ')
x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2)
print(int(math.hypot(x2 - x1, y2 - y1)))
| true |
b6015a7c6136bbef0ae28692d74b4e58d5013a1f | HundredVisionsGuy/Python-API-Examples | /cat_facts.py | UTF-8 | 1,701 | 4.4375 | 4 | [] | no_license | ##########################################################
# cat_facts.py
# by Chris Winikka
#
# Purpose: demonstrate how to use Python 3 and requests
# to capture and process JSON data
##########################################################
# import statements
import requests
# Build out a new API c... | true |
1988d0fdc8e0354104bd4c5687c8617083489f6a | shivamag125/tasks_hep_2020 | /quantum_1.py | UTF-8 | 716 | 2.78125 | 3 | [] | no_license | import cirq
import numpy as np
from cirq import Circuit
from cirq.devices import GridQubit
=
length = 3 #number of qbits=9, required=5
qbits = [cirq.GridQubit(x,y) for x in range(length) for y in range(length)]
print(qbits)
circuit = cirq.Circuit()
circuit.append(cirq.H(q) for q in qbits[:5]) #applying hadamard op to a... | true |
cbd308eb8c9754808ab3baea1a5205cc0dc0667f | Tanish74/Code-and-Compile | /count of common factors.py | UTF-8 | 904 | 3.921875 | 4 | [] | no_license | """
Given a set of numbers where all other numbers are multiple of the smallest number,
the program must find the count of the common factors C excluding 1.
Input Format:First line will contain the integer value N representing how many numbers are passed as input.
Next N lines will have the numbers.Output Format:First... | true |
b898a3ccf075202d3d946d0f98471a9f5d71020f | xc145214/practise | /python/test2.py | UTF-8 | 4,380 | 4.28125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
函数定义:
函数代码块以def关键词开头,后接函数标识符名称和圆括号()。
任何传入参数和自变量必须放在圆括号中间。圆括号之间可以用于定义参数。
函数的第一行语句可以选择性地使用文档字符串—用于存放函数说明。
函数内容以冒号起始,并且缩进。
Return[expression]结束函数,选择性地返回一个值给调用方。不带表达式的return相当于返回 None。
"""
# Function definition is here
def printme( str ):
"print any string in"
print str;
return;
# N... | true |
07a8e73cf6597d2a7123fabe4a68a43ac0887558 | MapleStoryBoy/spider | /python爬虫开发与项目实战笔记/爬虫/数据存储/csv文件.py | UTF-8 | 521 | 3.984375 | 4 | [] | no_license |
#写入
import csv
with open('data.csv','w') as csvfile:
writer = csv.writer(csvfile)
#writerow()方法传入每行的数据
writer.writerow(['id','name','age'])
writer.writerow(['10001','Mike',20])
writer.writerow(['10002','Jsp',21])
writer.writerow(['10003','Bob',22])
#初始化写入对象时传入delimiter 为空格,此时输出结果的 每一列就是以空格分隔了... | true |
ce7ce3b862acd1936d57140d138a46641f66265f | ystoyanov/MachineLearningMisc | /QuantileRegression.py | UTF-8 | 3,805 | 3.765625 | 4 | [] | no_license | """
Code for blog article on Quantile Regression
"""
import numpy as np
import matplotlib.pyplot as plt
## Generate some data with constant variance /noise
x = np.arange(100).reshape(100,1)
intercept_ = 6
slope_ = 0.1
## non constant error
error_ = np.random.normal(size = (100,1), loc = 0.0, scale = 1)
## Regress... | true |
d6ed98f0bdb4a4238d5676c6f2ab1fefe6727a17 | hikarine3/programming_language_comparison | /examples/file/check_dir_existence/check_dir_existence.py | UTF-8 | 286 | 3.0625 | 3 | [] | no_license | import os
base_dir = os.path.dirname(__file__)
if not base_dir:
base_dir = "."
exit_dir = base_dir + '/a_dir'
not_exist_dir = base_dir + '/b_dir'
if(os.path.exists(exit_dir)):
print("Found: " + exit_dir)
if(not os.path.exists(not_exist_dir)):
print("Not Found: " + not_exist_dir)
| true |
bc2907066b21334781e13052707caeb0eabf000b | EdgarDorausch/python-doodle | /ray_march.py | UTF-8 | 10,829 | 2.921875 | 3 | [] | no_license | # To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
import matplotlib.pyplot as plt
import numpy as np
import torch
from typing import Tuple
from torch import device, inverse
dev = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
print('Divice: ', dev)
de... | true |
0f608b02398943194a27ba8dffc01a9f1e10688d | fabriziodemaria/LeetCode_Solutions | /Maximum Depth of Binary Tree/main.py | UTF-8 | 698 | 3.109375 | 3 | [] | no_license | class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def __init__(self):
self.maxD = 0
self.result = 0
def incMax(self):
#pdb.set_trace()
self.maxD += 1
if self.maxD > se... | true |
03b5e51bd92f90d9d2ab56de2819c68efcfd0d49 | modal/tktoolbox | /tktoolbox/examples/ticker_canvas.py | UTF-8 | 1,320 | 3.546875 | 4 | [
"Apache-2.0"
] | permissive | ''' Tk_Canvas_ticker1.py
using a Tkinter canvas to create a marquee/ticker via
canvas.create_text(x, y, anchor='nw', text=s, font=font)
canvas.move(object, x_increment, y_increment)
tested with Python27 and Python33 by vegaseat 04oct2013
'''
import time
try:
# Python2
import Tkinter as tk
except ImportError:... | true |
1f7a96793e5b601583236f5f2f8e54a7e5b25c30 | biolchen/biologistLearningPython | /dash/1-03-LineCharts/line1.py | UTF-8 | 858 | 3.25 | 3 | [] | no_license | #######
# This line chart displays the same data
# three different ways along the y-axis.
######
import plotly.offline as pyo
import plotly.graph_objs as go
import numpy as np
np.random.seed(56)
x_values = np.linspace(0, 1, 100) # 100 evenly spaced values
y_values = np.random.randn(100) # 100 random values
# create... | true |
534c2c305ac87b7b9088ccaf7ad8acd9ab9c2388 | bochf/python | /rmq/exchange/send.py | UTF-8 | 530 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
import pika
import sys
import time
def main(host, msg):
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host))
channel = connection.channel()
channel.exchange_declare(exchange='logs', type='fanout')
# send message to exchange
channel.basic_publish(... | true |
182ca8b55137bff079599ea96271fa18686ebd97 | entojansen/nontarget-effects-study | /2015/data arrangement/arrange_data.py | UTF-8 | 6,125 | 2.625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
'''
Created on Fri Apr 13 10:33:08 2018
@author: Andrew
'''
import os
from copy import deepcopy as dc
class sample:
'''
Args should be formatted as follows:
date (as month.date.year, ex: vii.03.2015); method (malaise, pitfall, or sweep);
block (as in block 2 if sa... | true |
ff42a7bd48013e7d9df6f57e011b38d629f141a9 | 0xb1dd1e/PipelineConstructionSet | /python/maya/site-packages/pymel-1.0.3/maya/utils.py | UTF-8 | 16,071 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | """
General utility functions that are not specific to Maya Commands or the
OpenMaya API.
Note:
By default, handlers are installed for the root logger. This can be overriden
with env var MAYA_DEFAULT_LOGGER_NAME.
Env vars MAYA_GUI_LOGGER_FORMAT and MAYA_SHELL_LOGGER_FORMAT can be used to
override the default format... | true |
6fd4b4b301f18daa00ada31f5210c88e4d86ae18 | HG13BB/Coursera_Data_Structures | /job_queue_5.py | UTF-8 | 3,114 | 3.25 | 3 | [] | no_license | #Python3
class BinHeap:
def __init__(self):
self.heapList = [0]
self.currentSize = 0
self.resultlist = []
self.jobtime = 0
self.workers = []
self.jobs = []
self.job = 0
self.worker = 0
def percUp(self,i):
while i // 2 > ... | true |
b2cab13c17579d4e9692d643ef89992d2cb228ae | SwordLoveDev/AlgorithmBasicPython | /algoGloutonMonnaieCentimes.py | UTF-8 | 761 | 4.25 | 4 | [] | no_license | """
Algorithme qui permet de rendre la monnaie à partir d’une liste donnée de valeurs de pièces et de billets.
"""
pieces = [200,100,50,20,10,5,2,1,0.5,0.2,0.1,0.05,0.02,0.01]
def rendreMonnaie(arendre):
somme_restante = arendre
compteur = 0
resultat = []
while round(somme_restante, 2) > 0:
... | true |
3d8db12a4d92a4c352e8fa47be11a8487e44603a | lilylingzhao/excalibur | /py/excalibur.py | UTF-8 | 16,713 | 2.734375 | 3 | [
"MIT"
] | permissive | # Functions needed to run Excalibur
# Data munging in separate file
from os.path import basename
import numpy as np
from astropy.time import Time
from scipy import interpolate, optimize
from tqdm.auto import trange
import warnings
warnings.simplefilter('ignore', np.RankWarning)
######################################... | true |
ea4cbb0448997334895966bad4cb7966f227bf0a | xxyyss/synchronous_tdoa_multisensor_model | /computer/hardware/sound/Microphone.py | UTF-8 | 1,078 | 2.625 | 3 | [] | no_license | from Position import Position
from Time import Time
from sound import Sensor as SoundSensor
from Hardware import Hardware
from .States import States
from MulticastDelegate import MulticastDelegate
class Microphone(Hardware):
def __init__(
self,
time: Time,
position: Position,
... | true |
1f94f13aaa97d5c54bf92d7def88a33d8f1c9c64 | kranz912/Algorithms | /Problems/9-RearrangeChar.py | UTF-8 | 948 | 3.96875 | 4 | [] | no_license | '''
Rearrange characters in a string such that no two adjacent are same
Given a string with repeated characters, the task is to rearrange characters in a string so that no two adjacent characters are same.
Note : It may be assumed that the string has only lowercase English alphabets.
Examples:
Input: aaabc
Output:... | true |
6771fc9c188c1fbec06ec28c08bada47dd6ef0e8 | dodqjfehfl/This_is_coding_test | /CHAPTER06/6-11.py | UTF-8 | 266 | 3.21875 | 3 | [] | no_license | n=int(input())
array=[]
for i in range(n):
input_data=input().split()
array.append((input_data[0], int(input_data[1])))
array=sorted(array, key=lambda student:student[1])
for student in array:
print(student[0], end=' ')
#2
#홍길동 95
#이순신 77 | true |
a8aaf9a068d12f0aa0dc8ea486189c9def0aa0f3 | goran-mahovlic/OSM_drawing_machines | /workshop/part_6/draw_OSM_plot_OpenCV_pygame.py | UTF-8 | 6,377 | 2.734375 | 3 | [] | no_license | # OpenStreetMap art drawing project
# Project was done at Electric Wonderland camp
# Authors: Goran Mahovlić, Igor Brkić, Ana Horvat, Paula Bučar, Mark Bilandžić, Jurica Zrna, Tomislav Mikić
# How it works?
# Show random water surfaces from random cities (currently from list) on random location of the graf(picture)
f... | true |
9cf1dd3e4446da583f2409efec1e1db47f772009 | dan-wells/pi-display | /plugins/pacman.py | UTF-8 | 2,245 | 2.515625 | 3 | [] | no_license | import subprocess
import re
import time
import os
from dot3k.menu import MenuOption
class PacmanStats(MenuOption):
def __init__(self):
self.last_update_set = 0
self.update_count_set = 0
MenuOption.__init__(self)
def get_last_update(self):
# use context manager otherwise PIPE s... | true |
3a6eb0915d7e52fc5097c2db9818de97c49f2dab | renancasstro/modulo2-igti | /trabalho_pratico.py | UTF-8 | 901 | 2.953125 | 3 | [] | no_license | import numpy as np
import pandas as pd
Z = np.zeros((4, ))
print("Z:", Z)
Z = np.zeros((4, ))
Z[1] = 1.
print("Z:", Z)
Z = np.zeros((4, ))
Z[1:] = 1.
print("Z:", Z)
Z = np.zeros((4, ))
Z[:3] = 1.
print("Z:", Z)
X = np.array([[2., 2.],[2., 2.]])
print("X:\n", X)
X = np.array([[1, 2], [3, 4]])
Y = X[0, :]
Y[1] = 10... | true |
45af15029661bb6f339dd34f824ca609158099c7 | Huo12345/Interpolation-of-handwritten-Digits | /code/digit-interploation/ai/NeuronalNetwork.py | UTF-8 | 847 | 2.921875 | 3 | [] | no_license | from abc import ABC, abstractmethod
import numpy as np
class NeuronalNetwork(ABC):
@abstractmethod
def feed_forward(self, x: np.ndarray) -> np.ndarray:
pass
@abstractmethod
def get_label_count(self) -> int:
pass
def predict(self, x: np.ndarray) -> np.ndarray:
return np.... | true |
88d51cc50f9a43f6ee5ffd9d9f564eef21d572bd | sorglos123/Caesar_vigenere | /script.py | UTF-8 | 3,364 | 3.03125 | 3 | [] | no_license | alphabet = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
input = "xuo jxuhu! jxyi yi qd unqcfbu ev q squiqh syfxuh. muhu oek qrbu je tusetu yj? y xefu ie! iudt cu q cuiiqwu rqsa myjx jxu iqcu evviuj!"
#First Ceasar Cipher
#Function to decode input with specific offset
def decode(mes... | true |
c87f40e4990a2c03bb6f032390e57943326759dd | abhisheksahnii/python_you_and_me | /average_of_N_numbers.py | UTF-8 | 251 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python3
N = 10
sum = 0
count = 0
while count < N:
number = float(input("")) # FIXIT # TODO
sum = sum + number
count = count + 1
average = float(sum)/N
print("N = %d , Sum = %f" % (N,sum))
print("Average = %f") % average
| true |
a7130ce13bee244e3ccd196c4879d596ffe8cb2a | Wyuchen/python_hardway | /10.py | UTF-8 | 806 | 3.75 | 4 | [] | no_license | #!/usr/bin/python
#coding=utf-8
#笨办法学 Python-第十题
#转义字符的使用
print '字符串中双引号的转义:'
print "i am 6'2\"tail"
print '字符串中但引号的转义:'
print 'i am 6\'2" tail'
print "\\t 代表tab,\\n 代表回车 \\ 代表 \\"
print '\ti am tabbed in'
print 'i\'m split\non a line'
print "i'm \\ a \\ cat"
print '转义序列和格式化字符串放到一起:'
print '\t this is a %s' % 'dog\... | true |
250693105f24c74b67783b58bcc47a011132c560 | 111110100/my-leetcode-codewars-hackerrank-submissions | /leetcode/findNumbers.py | UTF-8 | 406 | 3.375 | 3 | [] | no_license | from typing import List
class Solution:
def findNumbers(self, nums: List[int]) -> int:
return sum([1 for num in nums if len(str(num)) % 2 == 0])
class Solution2:
def findNumbers(self, nums: List[int]) -> int:
return sum(1 for i in nums if 9 < i < 100 or 999 < i < 10000 or 99999 < i < 1000000)
... | true |
97967ac9884ff85973e45a5466bec496cfe775e6 | Chaostheorie/basho | /app/models.py | UTF-8 | 8,387 | 2.515625 | 3 | [
"MIT"
] | permissive | import typing
from secrets import token_urlsafe
from hashlib import md5
from datetime import datetime
from ujson import dumps
from sqlalchemy.sql.sqltypes import Text
from werkzeug.security import generate_password_hash, check_password_hash
from . import db, app
class Role(db.Model):
__tablename__ = "roles"
... | true |
2a7149996285aaccfc9f952749b8b19e90e64baa | lzh107u/final_project | /cameratest.py | UTF-8 | 2,504 | 2.65625 | 3 | [] | no_license | # MIT License
# Copyright (c) 2019 JetsonHacks
# See license
# Using a CSI camera (such as the Raspberry Pi Version 2) connected to a
# NVIDIA Jetson Nano Developer Kit using OpenCV
# Drivers for the camera and OpenCV are included in the base image
import cv2
import numpy as np
# gstreamer_pipeline returns a GStream... | true |
059131565edb8ac04b73881c45ec4eb3ed3f42c6 | AmineBenaceur/Snake-PyQt5 | /SnakeClasses.py | UTF-8 | 4,806 | 2.703125 | 3 | [] | no_license | from PyQt5.QtCore import (QRectF, Qt)
from PyQt5.QtGui import (QBrush, QColor, QImage)
from PyQt5.QtWidgets import QGraphicsItem
class BonusQGraphics(QGraphicsItem):
def __init__(self, xy, icon='graphics/bonus.png'):
QGraphicsItem.__init__(self)
self.icon = icon
self.xy = xy
def... | true |
8ed1c5f1ee711cb8c59a2a0ecdbb5216e531596f | wisteknoll/self_taught | /st_011.py | UTF-8 | 383 | 3.59375 | 4 | [] | no_license | def add_f(x, y, z, a=10, b=7):
print("x=" + str(x))
print("y=" + str(y))
print("z=" + str(z))
print("a=" + str(a))
print("b=" + str(b))
sum1 = int(x) + int(y) + int(z)
print("x+y+z=" + str(sum1))
sum2 = sum1 + a + b
print("x+y+z+a+b=" + str(sum2))
xx = input("x=")
yy = input("y=")
z... | true |
b7a38b6d8454003a7755e93a02708c626b17c2cc | njerigathigi/udemy-python-masterclass | /The_escape_character/practise.py | UTF-8 | 1,080 | 4 | 4 | [] | no_license | splitstring = 'this string has been\nsplit over\nseveral\nlines'
print(splitstring)
# \n starts a new line
tabbedstring = '1\t2\t3\t4\t5'
print(tabbedstring)
# \t used for TAB character.it makes a horizontal tab space between two strings or characters
print('The pet shop owner said,"no,no, \'e\'s resting".')
print("The... | true |
0d39228aecdb9e34a96d6cff0c86625ca7b2b1a8 | davixie/CES22_PlantsVsZombies | /constants.py | UTF-8 | 701 | 2.828125 | 3 | [] | no_license | import pygame
import os
# Size of Screen
SCREEN_WIDTH = 1600
SCREEN_HEIGHT = 900
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
# Size of Rows
ROW_SPACE = 100
COLUMN_SPACE =300
rows = [0, ROW_SPACE, 2*ROW_SPACE, 3*ROW_SPACE, 4*ROW_SPACE]
columns = [0, COLUMN_SPACE, 2*COLUMN_SPACE, 3*COLUMN_SPACE, 4*C... | true |
9eaabc6ef4abd2e11fb42d2ba8a90f8e59825fdf | hsed/ml-cw | /code/dataImporter.py | UTF-8 | 2,218 | 2.65625 | 3 | [] | no_license | # module data-importer
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from numpy.random import RandomState
class dataImporter(object):
def __init__(self, filePath='spambase.data', shuffle=True, splitRatio=0.75, strat... | true |
d7228073d1e7aa8c0bbab74c5642dc70bdcbd237 | Daksh/Daksh.github.io | /resources/proSort68/new_problem.py | UTF-8 | 921 | 2.765625 | 3 | [
"MIT"
] | permissive | iTa={1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e', 6: 'f', 7: 'g', 8: 'h', 9: 'i', 10: 'j', 11: 'k', 12: 'l', 13: 'm', 14: 'n', 15: 'o', 16: 'p', 17: 'q', 18: 'r', 19: 's', 20: 't', 21: 'u', 22: 'v', 23: 'w', 24: 'x', 25: 'y', 26: 'z'}
aTi={'q': 17, 's': 19, 'k': 11, 'u': 21, 't': 20, 'f': 6, 'n': 14, 'l': 12, 'j': 10, 'g': ... | true |
160c6ae5e1ec9c815a43d10feb2eee36b3916edb | mdaamir151/WiktionaryDumpParser | /scripts/N46.py | UTF-8 | 978 | 2.59375 | 3 | [] | no_license | import re
import os
f = os.path.basename(__file__).split('.')[0]
outseq = int(f[1:])
inseq = outseq - 1
file = open("N"+str(inseq)+".xml","r",buffering=1,encoding='utf-8')
file_o = open("N"+str(outseq)+".xml","w",buffering=1,encoding='utf-8')
regex = re.compile(r'{{(?P<name>alter|alt form)\|?(?P<def>.*?)}}',re.IGNOR... | true |
3a5c68822e4926e538fcf5c102274ab6fa7f71df | illfalcon/WebHW | /project2/application.py | UTF-8 | 2,545 | 2.65625 | 3 | [] | no_license | import os
from flask import Flask, render_template, jsonify, request
from flask_socketio import SocketIO, emit
app = Flask(__name__)
app.config["SECRET_KEY"] = os.getenv("SECRET_KEY")
socketio = SocketIO(app)
class Channel:
def __init__(self, name, creator):
self.name = name
self.creator = creato... | true |
2834e52cfb6d2e9c5a5c95dc589b18a7fe15e4fe | k4rm4/Python-Exercises | /esercizio8.py | UTF-8 | 191 | 2.8125 | 3 | [] | no_license | x = input ("Inserisci sto conicio: \n")
if x == "bunny":
print ("hello little bunny")
elif x == "bugs":
print ("What's up doc?")
else:
print ("Run away! Run away! ...")
| true |
83d6eb43b5b139487c61874d3d287150adadeea4 | dsvivass/Using-python-to-access-web-data | /4. ProgramsThatSurfTheWeb/1. unicodeCharactersAndStrings.py | UTF-8 | 2,856 | 3.78125 | 4 | [] | no_license | # Para saber cual es el valor real para una letra podemos usar
# Nos devuelve el valor de un caracter en ASCII
print(ord('H')) # Ord significa el ordinal, antes solo se escribia con mayusculas, habian 128 caracteres
# Imprime 72
print(ord('h')) # Ord significa el ordinal, las minusculas tienen mayor valor
# Imprime 10... | true |
7e42a8a690eb7ac4c18d7da53abfee2795365253 | zcutlip/pyonepassword | /tests/test_redacted_string.py | UTF-8 | 6,797 | 3.296875 | 3 | [
"MIT"
] | permissive | from pyonepassword.string import RedactedString
def test_redacted_string_010():
"""
Create a RedactedString object
Verify the redacted string matches the expected value
"""
original_string = "An example, unredacted string"
expected = "************************tring"
redacted = RedactedStr... | true |