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 |
|---|---|---|---|---|---|---|---|---|---|---|
d27f1a894e554c484b851ba353e2753583d7e14c | Jordan-Cottle/Game-Design-Capstone | /StarcorpServer/starcorp/objects/resource.py | UTF-8 | 1,162 | 3.03125 | 3 | [
"MIT"
] | permissive | """ Module for resource related classes and logic. """
from data.json_util import Serializable
class Resource(Serializable):
""" A collectable resource in the game. """
def __init__(self, name, growth_weight, demand_ratio, base_price):
self.name = name
self.growth_weight = growth_weight
... | true |
d00534fddff58c3d1a3776397b52fd3dd581be12 | saurabhc123/cs5984Project | /Project/Source/Preprocess/main.py | UTF-8 | 3,831 | 2.9375 | 3 | [] | no_license | import gensim
import numpy as np
from nltk.stem import WordNetLemmatizer
from nltk.tokenize import word_tokenize
import string
def avg_feature_vector(words, model, num_features, index2word_set):
# function to average all words vectors in a given paragraph
featureVec = np.zeros((num_features,), dtype="float32"... | true |
611ecd30e31b190166c49de2f2d217008a365319 | forkcodeaiyc/skulpt_parser | /run-tests/t520.py | UTF-8 | 313 | 3.1875 | 3 | [
"MIT"
] | permissive | x = any([1, 2])
print(x, type(x))
y = all([1, 2])
print(x, type(x))
z = isinstance(5, int)
print(z, type(z))
print(hash(True), type(hash(True)))
print(hash(None) is hash(None), type(hash(None)))
print(hash("hello") is hash("hello"), type(hash("hello")))
a = hasattr("hello", "not_a_method")
print(a, type(a))
| true |
6e586f4b342732d7991f26497151d9528e04c8e1 | donmajkelo/kurs_Python | /zad_59_zad_dom_final.py | UTF-8 | 1,468 | 4 | 4 | [] | no_license |
def gra():
import random
print(f"Gramy w gre: Zgadnij liczbe z przedzialu 1-100. Masz 5 prob ")
los = random.randint(1, 100)
lista = []
while (True):
zm_pomocnicza = 0
x = int(input(f"Podaj liczbe: "))
lista.append(x)
if(len(lista)==5):
decyzja... | true |
08c32b6ba21762bd3f34e9b04231222e8f080124 | OrderFromChaos/ICPC | /aoc/6.py | UTF-8 | 1,231 | 3.671875 | 4 | [] | no_license | # It's BFS time :)
from collections import deque
import sys
class Node:
def __init__(self, name):
self.name = name
self.children = []
self.parents = []
def __repr__(self):
return str((self.children, self.parents))
# Construct graph
nodes = dict()
existing = set()
for line in l... | true |
b627ee88a94c68de1031e639b8836b397d21e397 | retr0rafay/Data-Structures | /MergeSortedArrays.py | UTF-8 | 375 | 3.515625 | 4 | [] | no_license | def mergeSortedArrays(array_one, array_two):
big_array = []
i = 0
j = 0
while i < len(array_one) and j < len(array_two):
if array_one[i] <= array_two[j]:
big_array.append(array_one[i])
i += 1
else:
big_array.append(array_two[j])
j += 1
return big_array+array_one[i:]+array_tw... | true |
499627959c6f6df38568ea5f6fe7d2f2a09d3f2f | cyw233/Australia_Social_Media_Analysis_Team33 | /scenarios/scenario3_suburb_analysis/suburb_analysis.py | UTF-8 | 4,327 | 2.640625 | 3 | [] | no_license | # Cluster and Cloud Computing Assignment 2
# Team 33
# Chenyang Gao, Chenyang Wang, Naijun Wang, Xiaoming Zhang, Yangyang Luo
# This file is used for scenario 3 which is to find out the total sentiment
# score and the number of tweets in each suburb of Melbourne. After getting
# the result, we will analyze the relatio... | true |
0f296812d98436cfe61263fdde54ca3dc9e94a44 | BulgakovMax/Exchange_games | /src/blueprint/game_blueprint.py | UTF-8 | 2,819 | 2.578125 | 3 | [] | no_license | from flask import Blueprint, render_template, request, redirect
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, IntegerField, FloatField, validators, FileField
from wtforms.validators import DataRequired
from utils import upload_image
from db import db
from models.models import GameModel
... | true |
527b43915e4574027232dda938ce43dd7d257563 | Demirose41/rpc_python | /rpc.py | UTF-8 | 3,343 | 3.5625 | 4 | [] | no_license | #print ("rock")
#print ("paper")
#print ("scissors")
#
#print ("Who is the first challenger :")
#player1 = input()
#print ("Who is the second challenger :")
#player2 = input()
#
#
#
#print(f"{player1} VS {player2}")
#
#
#if player1 == player2 :
# print("please find a friend")
#elif player1 == "Car":
# print("CA... | true |
bc22adda7311be0e1804ca78ddb7b8f4508835ce | tmcelreath/python-algorithms | /algorithms/graph_algorithms/dijkstra/dijkstra.py | UTF-8 | 4,750 | 3.25 | 3 | [] | no_license |
# List-based algorithm
def dijkstra(G, v):
dist_so_far = {}
dist_so_far[v] = 0
final_dist = {}
while len(final_dist) < len(G):
w = shortest_dist_node(dist_so_far)
final_dist[w] = dist_so_far[w]
del dist_so_far[w]
for x in G[w]:
if x not in final_dist:
... | true |
641d93c2a56833435002ff85d1c1f30fce08a13e | angadaws/LeetCode | /isIsomorphic.py | UTF-8 | 536 | 3.09375 | 3 | [
"MIT"
] | permissive | class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
hashMapA = {}
hashMapB = {}
for idx in range(len(s)):
if s[idx] not in hashMapA and t[idx] not in hashMapB:
hashMapA[s[idx]] = t[idx]
hashMapB[t[idx]] = s[idx]
else:
... | true |
2670d8726f951e58eb0331eeb9decf052c4430b0 | filvi/aml-challenge | /assets/intro.py | UTF-8 | 268 | 2.953125 | 3 | [] | no_license | import requests
def greetings():
print("\n\n")
ascii_art = requests.get("http://artii.herokuapp.com/make?text=Roosters&font=slant")
print(ascii_art.text)
print("%-20s %-20s %-20s %-20s" % ("Andrea Lomurno", "Jacopo Mocellin", "Tamara Quaranta", "Filippo Vicari"))
print("\n\n") | true |
372aca36dfc974e535959f823f6373636d0cedac | alicavdar91/ASSIGMENTS | /Assignment 3 (Measure Converter).py | UTF-8 | 794 | 4.5 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Assignment-3 (Measure Converter)
# Task-1:
#
# Write a short Python program that asks the user to enter Celsius temperature (it can be a decimal number), converts the entered temperature into Fahrenheit degree and prints the result.
#
# Task-2:
# Write a short Python program... | true |
5aa478f50c00560ca84b44f65e3720851f149683 | hoon0422/Text_to_Excel | /basic/sheetdata/sheetinfo.py | UTF-8 | 2,411 | 3.5625 | 4 | [] | no_license | """
This module has classes for information when manipulating a worksheet.
"""
import abc
from xlwings import Sheet
from typing import TypeVar, Generic, List
S = TypeVar('S')
class SheetInfo(Generic[S]):
""" This abstract class represents information of how to manipulate a worksheet.
Attribute:
... | true |
6a2855bdc49540138c4d15ec980067f43e2234e2 | ydoublemm/pythoncode | /装饰器/demo2.py | UTF-8 | 312 | 2.953125 | 3 | [] | no_license | def log(text):
def decorator(func):
def warpper(*args,**kw):
print("%s %s()" % (text,func.__name__))
return func(*args,**kw)
return warpper
return decorator
@log("111")
def now():
print('01点24分')
now = log('execute')(now)
print(now.__name__)
now()
| true |
595a3f26b76da8ceb760d0d80214fb6470fe2594 | rupertsmall/cs-101 | /nroot.py | UTF-8 | 697 | 3.40625 | 3 | [] | no_license | # calculate the n'th root of p
from sys import argv, exit
epsilon = .0000000001 # something tiny
error = 1 # something un-tiny
# get number from command line
if len(argv) < 3:
exit('usage: '+argv[0]+' number root')
else:
# order of magnitude for seed guess
p = float(argv[1])
n = float(argv[2]) # ... | true |
2a31dbd345ed7eadff4a12d490a2aec60e7f78d9 | gdenn/crypto-corner | /cipher/test_helper.py | UTF-8 | 688 | 3.375 | 3 | [] | no_license | from random import seed, sample
from typing import List
from cipher.alphabet import Alphabet
class TestHelper:
@classmethod
def gen_word(cls, whitespaces=True) -> str:
alphabet = Alphabet.alphabet
alphabet_len = Alphabet.alphabet_len
if whitespaces:
alphabe... | true |
4ef32d1b746209b95d6249dab8a882bda858aefa | vidhi98/Python | /Leaders in an araay.py | UTF-8 | 352 | 2.859375 | 3 | [] | no_license | T=int(input())
for j in range(T):
arr=[]
result=[]
n=int(input())
arr = list(map(int,input().split()))
max=arr[n-1]
result.append(max)
for i in range(n-2,-1,-1):
if arr[i]>max:
result.append(arr[i])
max=arr[i]
result.reverse()
print(*resul... | true |
dc76be437385dbad81055255bec2af7a8df87938 | HORSESUNICE/webscraping | /mongodb.py | UTF-8 | 2,120 | 2.921875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import pymongo
client = pymongo.MongoClient('localhost',27017)
xiaozhu = client['xiaozhu']
bnb_info = xiaozhu['bnb_info']
# ====================================================== <<<< 单页行为 >>>> =============================================
url = 'http://bj.xiaozhu.com/s... | true |
1c4399c376b3f1836112e9b1b2b2e743daae1d8b | mjasperse/aztec_diamond | /gui.py | UTF-8 | 3,315 | 3.1875 | 3 | [] | no_license | # AZTEC DIAMOND "SQUARE DANCE"
# Martijn Jasperse, Dec 2020
#
# Inspired by Mathologer's video on the "arctic circle theorem"
# https://www.youtube.com/watch?v=Yy7Q8IWNfHM
# This is a really simple PySide-based GUI that draws the result of the aztec diamond iteration algorithm
# Allows user to see how the pattern evol... | true |
bd73aaf51bfdaa58009c21c063d7b60950c9c2c8 | CrashOverrideProductions/Uni_Tasks | /SIT384 - Data Analytics for Cyber Security/Task7-1P/7-1p.py | UTF-8 | 2,456 | 3.15625 | 3 | [] | no_license | # Unit: SIT384 - Cyber Security Analytics
# Task: Pass Task 7.1p
# Author: Justin Bland
# Date: 04/05/2020
# Imports Required
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
from sklearn.cluster import KMeans
from scipy.cluster.hierarchy import ... | true |
ddb3c7e7997fe2d2f2e8d22d422677dbc7910717 | MiguelAleixo/meuPrimeiroProjeto | /meuPrimeiroProjeto/views.py | UTF-8 | 661 | 2.828125 | 3 | [] | no_license | from django.http import HttpResponse
from django.shortcuts import render
def hello(request):
return HttpResponse('Ola')
def numbers(request, year):
return HttpResponse('Ola numeros: ' + str(year))
def consult(request, name):
res = solicitDataBase(name)
# return HttpResponse('Mensagem automática: '... | true |
634c28fed11170944c205b1ec75520c01d3471e0 | xytracy/python | /ex5.py | UTF-8 | 649 | 3.59375 | 4 | [] | no_license | my_name='ZED a.SHAW'
my_age=35 #not a lie
my_height=74 #inches
my_weight=180 #lbs
my_eyes='blue'
my_teeth='white'
my_hair='black'
# put % and data type in string (with no space)
#put %,space,and values after string
print" let's talk about %s." %my_name
print"he's %d inches tall." %my_height
print"he's %d p... | true |
c77f43a48bb8719b3f386daf5cda1032c9794474 | danbailo/Python | /Livro Python/CursoPython/progs/p051_regexps_espertas.py | UTF-8 | 1,261 | 3.84375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 4 20:45:50 2019
@author: notebook
"""
#P051 Regexps com metacaracteres no search()
import re
#(1)-Importa todo o arquivo para um stringão e depois o converte para uma lista
# (cada linha do arquivo vira um elemento da lista)
nomeArq = 'C:/CursoPython/dez... | true |
04227efdac997aeb9a9c48bb0826bdada18039db | InesIvanova/Pet-store | /Models/models.py | UTF-8 | 5,388 | 3.4375 | 3 | [] | no_license | from abc import ABC, abstractmethod
from dateutil.parser import parse
class User:
def __init__(self, first_name, last_name, password, match_pass, phone):
self.first_name = first_name
self.last_name = last_name
self.password = password
self.match_pass = match_pass
self.phone ... | true |
d21249486d229e2d85b7058df0a4622c97c4411a | 13junio/Aprendendo-Python | /ex015.py | UTF-8 | 195 | 3.421875 | 3 | [
"MIT"
] | permissive | dias = int(input('Quantos dias o carro ficou alugado? '))
km = float(input('Quantos km o carro rodados? '))
pago = (dias * 60) + (km * 0.15)
print('O valor a ser pago é R${:.2f}'.format(pago))
| true |
e4ba81190a7916f8126751be899021a2c33d1f52 | sarnthil/thesis | /datasets/crawling/shuffle.py | UTF-8 | 654 | 2.859375 | 3 | [] | no_license | import sys
import json
from random import shuffle
def limit(iterable, number=10):
'''L3vi's trick'''
for x, _ in zip(iterable, range(number)):
yield x
def get_domain(url):
if url:
return url.split('/')[2]
else:
return None
if __name__ == '__main__':
print("Reading JSON fi... | true |
2f6983c5ff9d65ec0b4979b67062cc9061901c22 | vishal-1codes/python | /LISTS_AND_FUNCTIONS/Modifying_an_element_of_a_list_in_a_function.py | UTF-8 | 115 | 3.578125 | 4 | [] | no_license | #Here we modify the list
def list_function(x):
x[1] = x[1] + 3
return x
n = [3, 5, 7]
print(list_function(n)) | true |
2122ab608db150516e1c7252f19b38f5364d0a27 | Catcheryp/CTF | /ctf_events/hacktivitycon_21/the_library/ropstar.py | UTF-8 | 2,303 | 2.640625 | 3 | [] | no_license | from pwn import *
def start(argv=[], *a, **kw):
if args.GDB: # Set GDBscript below
return gdb.debug([exe] + argv, gdbscript=gdbscript, *a, **kw)
elif args.REMOTE: # ('server', 'port')
return remote(sys.argv[1], sys.argv[2], *a, **kw)
else: # Run locally
return process([exe] + ar... | true |
d46c90f6a475bdc4477e876ad14af331a7f35244 | Tekpre012/grass-addons | /tools/std_dataset_display.py | UTF-8 | 6,520 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
import os
import grass.script as gscript
from PIL import Image
import argparse
# before the script runs, old maps and existing images must be removed
# g.remove type=raster name=slope,aspect,profile_curvature,shade -f
# rm *.png
# the size of images could be different between different dataset
D... | true |
29132df1d507f1c19b740124ae9eb6a92b7968b6 | doriszyj/EC504_Network_Flow_Image_Segmentation | /main.py | UTF-8 | 3,869 | 2.640625 | 3 | [] | no_license | '__author__' == 'qiuxuan.lin'
# coding: utf-8
# Python 2.7.11
from datetime import datetime
from IPython import embed
import gc
import sys
sys.path.append('/Users/Shane/Documents/EC504_Network_Flow_Image_Segmentation/')
from image_process.GMM.proba import proba_gmm
from max_flow.mincut_fordfulkerson import mincut
from... | true |
690c909e0c4f03546ae4275b7f6b4d9330f90db2 | yashton/compiler | /submitted/test.518.py | UTF-8 | 147 | 3.078125 | 3 | [] | no_license | def foo():
return 2
def bar(x):
if x == 0:
return 1
else:
return 0
def foobar():
if x == 1:
y = 2
else:
y = 3
| true |
d246a61ae91fb34e744f0d70e28687b4c7330a22 | rpm1995/LeetCode | /1086_High_Five.py | UTF-8 | 689 | 3.1875 | 3 | [
"MIT"
] | permissive | class Solution(object):
def highFive(self, items):
"""
:type items: List[List[int]]
:rtype: List[List[int]]
"""
students = {}
ans = []
for student, score in items:
if student not in students:
students[student] = []
stu... | true |
6484a85642332cf88685a0f0bf0ec9e4a33b4bc4 | shaoda06/python_work | /Part_I_Basics/exercises/exercise_9_12_my_admin.py | UTF-8 | 382 | 2.984375 | 3 | [] | no_license | # 9-12. Multiple Modules: Store the User class in one module, and store the
# Privileges and Admin classes in a separate module. In a separate file, create
# an Admin instance and call show_privileges() to show that everything is still
# working correctly.
from exercise_9_12_admin import Admin
my_admin = Admin('shao... | true |
ab7980a8d84a8b3df41d1106cf247830a3512dfd | generaltso/CSSE120 | /Session02_InputComputeOutput/src/m8_more_practice.py | UTF-8 | 2,577 | 4.34375 | 4 | [] | no_license | """
This module lets you practice:
-- calling functions from the MATH and RANDOM modules
-- capturing RETURNED VALUES in variables
-- INPUT and OUTPUT
Authors: David Mutchler, Amanda Stouder, Chandan Rupakheti, Katie Dion,
Claude Anderson, Delvin Defoe, Curt Clifton, their colleagues,
a... | true |
cb4bf5bb42e071a590cff942de45ddfb5c6ee904 | Pradeep1321/LeetCode | /Imp-ZigZag.py | UTF-8 | 669 | 3.234375 | 3 | [] | no_license | def convert(s: str, numRows: int) -> str:
nested_list=dict()
i = 0
j=0
if (len(s)<=2) or numRows == 1 :
return s
while j < (len(s)) and (len(s)) > numRows:
while i>= 0 and i < numRows and j< len(s):
nested_list.setdefault(i,[]).append(s[j])
i=i+1
... | true |
d3e454040747b553b5dffa9c9fd5fa7d727d5627 | ulyssesMonte/prog1-2019-telem-tica | /exercícios complementares/exercicios algoritmos v1.3 25.py | UTF-8 | 182 | 3.65625 | 4 | [] | no_license | Int1=int(input("digite um número "))
Int2=int(input("digite outro número "))
print("o coeficiente da divisão de",Int1," por ",Int2," é ",Int1//Int2," e o resto é ",Int1%Int2)
| true |
ba02f8089e856064545e5bd4a8d9d87a05621495 | elsherbini/snakemake_workshop_20210428 | /scripts/make_phylo_tree/concatenate_alignment.py | UTF-8 | 3,107 | 2.515625 | 3 | [] | no_license | from Bio import SeqIO, AlignIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import os
from collections import defaultdict
from collections import Counter
import argparse
def get_prots_and_strains(in_file):
all_prots = []
all_strains = []
with open(in_file, 'r') as infile:
for line in... | true |
18f22fbe370b8d38c15670d7854d2065521babef | GaryccOps/makergame | /data_collection/getMinMax.py | UTF-8 | 1,784 | 2.9375 | 3 | [] | no_license | import json
import requests
# get coordinates from online source and save it in file (called test.json here....)
# process the thing to get min max
# get the center of each of the blocks of larger area.
# get the coordinates of the sides of each of the block.
# convert to geojson
#
# get all four coordinate points
... | true |
95f1c4ec4edab9c8fae7271291cc877f67657cd7 | buxuele/100-days-of-code | /21_CTF/natas_19.py | UTF-8 | 1,133 | 2.625 | 3 | [] | no_license | #!/usr/bin/python3
# Time: 2019/04/23 1:21 PM
import re
import time
import requests
import base64
import codecs
"""
1. 查看初始的PHPSESSID, 用hex解码看看
2. python3 bytes ---> string:
b'some'.decode('utf-8')
3.
"""
username = 'natas19'
password = '4IwIrekcuZlA9OsjOkoUtwU6lhokCPYs'
url = f'http://{username}.natas.labs... | true |
d15006f1898f97bb6d5459db3df92ecf66e1ea10 | gburdge/python-exercises | /Project 6/practice 6 13 14.py | UTF-8 | 914 | 3.203125 | 3 | [] | no_license |
<!DOCTYPE html>
<html>
<head>
<title>Gregory's favorite things</title>
</head>
<body>
<h1>My favorite things</h1>
<h2>These are a few of my favorite things</h2>
<h3>Airplanes</h3>
<p>Here are some of my favorite planes!</p>
<ul>
<li>McDonnell Douglas planes</li>
<li>Boeing planes
... | true |
da534d335b108d2515ed48314ea4b4fc423aa899 | shasky2014/PythonLearning | /home_work/leetcode_00118.py | UTF-8 | 771 | 3.34375 | 3 | [] | no_license | # 118. 杨辉三角
from utils.dateUtils import run_time
@run_time
class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if numRows <= 0:
return []
if numRows == 1:
return [[1]]
bf_gen = sel... | true |
2267cf6f55755fc61e16b6ddd7f721577f453c03 | Byeori-Kim/Numerical-Method | /14.py | UTF-8 | 355 | 3.140625 | 3 | [] | no_license |
import math
def f(x):
return math.pow(x,2)-3
a=1.0
b=2.0
p=(a+b)/2
TOL=math.pow(10,-4)
N0=20
n=0
FA=f(a)
FP=f(p)
while n<N0:
while FP!=0 and (b-a)/abs(a)>=TOL:
print(p)
if FA*FP>0:
a=p
FA=FP
else:
b=p
p=(a+b)/2
FP=f(p)
n=n+1
p=... | true |
b431c197c57957557b6ad9aeb9f0fa0ba6fb658b | Aasthaengg/IBMdataset | /Python_codes/p03137/s160694138.py | UTF-8 | 444 | 2.703125 | 3 | [] | no_license | import sys
inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())
n, m = inintm()
X = inintl()
X.sort()
diff = []
i... | true |
ac331413b6e90a3e570cb7102faaa9cb394f9ea3 | DharanitharanG/PythonWorkspace | /fundamentals/03 Strings.py | UTF-8 | 844 | 4.5625 | 5 | [] | no_license |
''' strings in Python are arrays of bytes
representing unicode characters.
However, Python does not have a character data type,
a single character is simply a string
with a length of 1.
Square brackets can be used to access elements
of the string.
'''
a = "Hello, World!"
print(a[1])
'''Subst... | true |
0d5a76102e3673c884d20793068c48213884b700 | Knogg/pythonintask | /ISTp/2014/IVANOV_D_A/task_7_37.py | UTF-8 | 1,805 | 3.8125 | 4 | [
"Apache-2.0"
] | permissive | # Задача 7. Вариант 37
# Разработайте систему начисления очков для задачи 6, в соответствии с которой
# игрок получал бы большее количество баллов за меньшее количество попыток.
# Ivanov. D. A.
# 06.06.2016
import random
Reindeers="Дэшер","Дэнсер","Прэнсер","Виксен","Комет","Кьюпид","Дондер","Блитцен","Рудольф"
RandR... | true |
8f3a8dcb1535ea79b8104188e97dac31e1c6d666 | derekianrosas/homework63 | /custoiterator.py | UTF-8 | 1,039 | 3.71875 | 4 | [] | no_license | #iteration is lists dictionaries and tuples they are iterable, you need to implement your own iterations sometimes
#create a new class
class Lineup:
def __init__(self, players):
self.players = players
def __iter__(self):
self.n = 0
return self
def __next__(self):
if self.n < (len(self.players) - 1):
pla... | true |
c0bbfcabf414d214a8bd76bc79d52ae5daa3d8fd | peggypan0411/CREST-iMAP | /cresthh/UQ/optimization/pyevolve/G1DBinaryString.py | UTF-8 | 6,578 | 3.71875 | 4 | [] | no_license | """
:mod:`G1DBinaryString` -- the classical binary string chromosome
=====================================================================
This is the classical chromosome representation on GAs, it is the 1D
Binary String. This string looks like "00011101010".
"""
from GenomeBase import GenomeBase
import C... | true |
a98da924fe4699d72d7c26fe2b06774311bfdc76 | jordanascher/aula01_exercicioII | /AlunoGraduacao.py | UTF-8 | 310 | 2.71875 | 3 | [] | no_license | from Aluno import Aluno
class AlunoGraduacao(Aluno):
def __init__(self, codigo, nome, matricula, semestre):
Aluno.__init__(self, codigo, nome, matricula)
self.semestre = semestre
def imprimir(self):
Aluno.imprimir(self)
print("Semestre:", self.semestre)
| true |
6b2def9ba7cb59def90da0ef97872a6e9da3bb64 | mrkschan/hr | /algo/sherlock-and-pairs/main.py | UTF-8 | 261 | 2.921875 | 3 | [] | no_license | from collections import Counter
cases = input()
for i in xrange(int(cases)):
counter = Counter()
size = input()
nums = raw_input()
for i in nums.strip().split(' '):
counter[i] += 1
print sum(v * (v-1) for _, v in counter.items())
| true |
3327233c003776815fabe081d49e3c98986be92d | alexandraback/datacollection | /solutions_5688567749672960_0/Python/nzinov/A.py | UTF-8 | 333 | 3.140625 | 3 | [] | no_license | inf = 1000000000
dp = [inf for i in range(1000001)]
dp[1] = 1
for i in range(2, 1000001):
op = int(str(i)[::-1])
dp[i] = dp[i-1] + 1
if op < i and int(str(op)[::-1]) == i:
dp[i] = min(dp[i], dp[op] + 1)
t = int(input())
for case in range(t):
b = int(input())
print("Case #{}: {}".format(case ... | true |
d1bb3b8d950363504972e94d1ea94ae361572fcd | Bruno7kp/soap | /clientes/cliente_zeep.py | UTF-8 | 770 | 2.890625 | 3 | [] | no_license | import zeep
client = zeep.Client(wsdl='http://127.0.0.1:8888')
val1 = 10
print('%s é ' % val1 + ('par' if client.service.verifica_NumeroPar(val1) else 'impar'))
val2 = 11
print('%s é ' % val2 + ('par' if client.service.verifica_NumeroPar(val2) else 'impar'))
val3 = '529.982.247-25'
print(val3 + ' é um CPF ' + ('vál... | true |
7a5f9e1f1c8558a49428d847aa0f2a1764a959b1 | StopDragon/CSE1017 | /Training/#class3/실습 #3-5.py | UTF-8 | 120 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def mult(m,n):
ans = 0
while n > 0 :
n = n-1
ans = ans+m
return ans
| true |
dd519672d586ab898953b36e38c9fb805d4e4f4b | Aasthaengg/IBMdataset | /Python_codes/p03946/s977327405.py | UTF-8 | 234 | 2.671875 | 3 | [] | no_license | import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
N,T = LI()
A = LI()
m = A[-1]
ans = []
for i in range(N-2,-1,-1):
ans.append(m-A[i])
m = max(m,A[i])
print(ans.count(max(ans))) | true |
5668489d0c39b5dabad6bff450d11a948da7e35f | Farizabm/pp2 | /stepik/1.7.py | UTF-8 | 70 | 2.953125 | 3 | [] | no_license | a=int(2.99)
print(a)
print(int(-1.6))
print(9**19-(int(float(9**19)))) | true |
d2d26a0b5ee4a7d3299d07d37a61b8346eca677b | DavisDataScience/DataInterviewPrep | /Deep_Learning_1/ecommerce_predict_random_weights.py | UTF-8 | 796 | 2.84375 | 3 | [] | no_license | import numpy as np
from ecommerce_preprocess import get_data
X, Y = get_data()
M = 5 # hidden units
D = X.shape[1]
K = len(set(Y)) # number of predicting categories
W1 = np.random.rand(D, M) # weight 1
b1 = np.random.randn(M) # bias 1
W2 = np.random.randn(M, K) # weight 2
b2 = np.random.randn(K) # bias ... | true |
c62e7353465a4896f91a3b79735ea3356a43f559 | CedricKen/Python-GUI | /Colors/Color and text.py | UTF-8 | 970 | 3.296875 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
# this is the main root or main window
window = Tk()
window.geometry("600x400")
# this is the app title
window.title("Color in Tkinter")
# the app window here is 600x400 pixels
window.geometry("600x400")
window.config(background ='yellow')
label1 = ttk.Label(w... | true |
bbb87cb78a133fd6c53f34d4335ba56ce96376b3 | natemago/adventofcode2016 | /day3/day3part2.py | UTF-8 | 461 | 3.125 | 3 | [] | no_license | #!/usr/in/env python3
rows = []
count = 0
lc = 0
with open('input') as f:
for line in f:
sides = []
lc += 1
for s in line.strip().split(' '):
if s:
sides.append(int(s))
rows.append(sides)
if lc == 3:
for i in range(0,3):
triangle = sorted([rows[0][i], rows[1][i], row... | true |
770f827a50fa032af0a7d93e16da38e79c1975fd | sidharthsourav/Math-help-2.0-python | /Volumes_surfaces.py | UTF-8 | 3,249 | 3.109375 | 3 | [] | no_license | import math
def cube(side):
side=float(side)
tsa=6*side #tsa=Total surface area
volume=pow(side,3)
return(tsa,volume)
def cuboid(l,b,h):
l=float(l) #l=Length
b=float(b) #b=Breadth
h=float(h) ... | true |
cba9ee6074ff6fa40b80a4d443a0d5044e0231f4 | ALDrinkwater1989/book-review | /app.py | UTF-8 | 2,681 | 2.71875 | 3 | [] | no_license | import os
from flask import Flask, render_template, redirect, request, url_for
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
app = Flask(__name__)
app.config["MONGO_DBNAME"] = 'book_review'
app.config['MONGO_URI'] = 'mongodb+srv://root:rootUser@myfirstcluster-lrum9.mongodb.net/book_review?retr... | true |
907f06a05c8f109b73114709d02d0a861345a7f6 | trinhvanvuong/BrFAST | /tests/measures/__init__.py | UTF-8 | 1,340 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
"""Module containing the dummy sensitivity and usability cost measures.
They simulate the lattice displayed in our FPSelect example.
"""
from brfast.data.attribute import AttributeSet
from brfast.measures import UsabilityCostMeasure, SensitivityMeasure
SENSITIVITIES = {
frozenset({}): 1.0,
... | true |
4f4139fa28115f581517890625386791087875ec | jcohenp/DI_Exercises | /W4/D2/normal/class_exercises 2.py | UTF-8 | 336 | 4.09375 | 4 | [] | no_license | # Given this list: list1 = [5, 10, 15, 20, 25, 50, 20], find value 20 in the list, and if it is present,
# replace it with 200.
# Only update the first occurrence of a value
# Hint: Look at the index method
list1 = [5, 10, 15, 20, 25, 50, 20]
if 20 in list1:
find20 = list1.index(20)
find20 = 200
print(... | true |
5aea6c81104b98726ae985ebd42555d461978322 | AlbertGithubHome/Bella | /algorithm/palindrome/palindrome.py | UTF-8 | 822 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#a solution for palindrome game
#example 仙人似美娟 * 我 = 娟美似人仙
#result: 21978 * 4
__author__ = 'AlbertS'
def is_contain_same(curItem):
dtable = {}
for x in curItem:
if x in dtable:
return True
else:
dtable[x] = 1
return Fal... | true |
6415ba19c20783eb904d24fa331c25738a2e5a79 | CongChen2017/heroku-plotbot | /plotbotHW.py | UTF-8 | 4,312 | 3.03125 | 3 | [
"MIT"
] | permissive | # Dependencies
import matplotlib
matplotlib.use('Agg')
import tweepy
from datetime import datetime
import matplotlib.pyplot as plt
from matplotlib import style
import time
import os
import numpy as np
style.use('ggplot')
# Import and Initialize Sentiment Analyzer
from vaderSentiment.vaderSentiment import SentimentInte... | true |
e4f5ae6899cf56743b5c9fbf40ec3eb5c1abe393 | ColonelPanicc/n64all | /api/controller.py | UTF-8 | 1,647 | 3.03125 | 3 | [] | no_license | from input_types import InputTypes
from input import Input, Analog
class Controller:
def __init__(self):
self._buttons = {
InputTypes.ANALOG.value: Analog(),
InputTypes.LEFT_TRIGGER.value: Input(),
InputTypes.RIGHT_TRIGGER.value: Input(),
InputTypes.A_BUT... | true |
9d37feee18071249cea0c348b700271d1f95b8dc | Orekhvera/9Task | /9.py | UTF-8 | 381 | 3.609375 | 4 | [] | no_license | number = input('Введите число: ')
def check(number):
try:
int(number)
k = 1
for letter in number:
if int(letter) % 2 == 0:
k *= int(letter)
a = "Произведение четных цифр чила: " + str(k)
except:
a = 'Ввели не число!!'
return a
print(che... | true |
23181bb817adc011a19c1720bcfcd8358c9f01e7 | yunli45/pycharmProjectHome | /AdministrativePenalty/天津市/test7.py | UTF-8 | 628 | 2.53125 | 3 | [] | no_license | # coding:utf-8
# from urllib import request
#
import requests
url = 'http://scjg.tj.gov.cn/heping/zwgk/xzcfxx/index.html'
headers = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36'}
# 需要使用url和headers生成一个Request对象,然后将其传入urlopen方法中
... | true |
dd75c23fb821594d681d294f8ea69304eaabeb53 | kfsunzhihuaxxx/spider | /day08/Guazi/Guazi/spiders/guazi2.py | UTF-8 | 1,183 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from ..items import GuaziItem
class GuaziSpider(scrapy.Spider):
name = 'guazi2'
allowed_domains = ['www.guazi.com']
# 1.先删掉start_urls
# 2.重写start_requests()方法
def start_requests(self):
'''把所有要抓取的URL地址交给调度器入队列'''
for o in range(1,6):
... | true |
e58a42bfe792927f0161436d290a37edf1c70ba3 | ffadullgu/programaciondecomputadores | /codigo/python3/04_matriz.py | UTF-8 | 91 | 2.84375 | 3 | [] | no_license | M = []
for fila in range(3):
M.append([0]*6)
M[0][0] = 1
for fila in M:
print(fila)
| true |
7e209336987db029cc64f947438b8501e6340378 | strengthen/LeetCode | /Python3/736.py | UTF-8 | 4,398 | 3.140625 | 3 | [
"MIT"
] | permissive | __________________________________________________________________________________________________
sample 36 ms submission
from contextlib import contextmanager
class Solution:
def evaluate(self, expression: str) -> int:
tokens = expression.replace('(', '( ').replace(')', ' )').split(' ')[::-1]
sco... | true |
6f115faf91b71f3e0f70de190618f0228ffe4d17 | standardgalactic/simple-app | /demo.py | UTF-8 | 2,154 | 3.625 | 4 | [] | no_license | # import the image libraries
from PIL import Image, ImageDraw, ImageFont
# convert image to text
import pytesseract
# Google Cloud Translate package
from google.cloud import translate_v2
def get_text(image) :
""" convert the image to text in Italian """
# convert image to text
text = pytesseract.image_to_... | true |
59111253dea59bf067d7780960f28994b8d8c64c | BarathEswerN/TwitteRange | /src/Spark/spark_consumer.py | UTF-8 | 3,348 | 2.765625 | 3 | [] | no_license | import os
import sys
import json
import MySQLdb as mdb
from twitter import *
from pyspark import SparkContext
from pyspark.streaming import StreamingContext
from pyspark.streaming.kafka import KafkaUtils
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
from unidecode import unidecode
from dateutil... | true |
dd6dc4f673946b13ba7641dad4183834108663c5 | mbaityje/STRUCTURAL-GLASS | /LIB/module_measurements.py | UTF-8 | 15,840 | 3.265625 | 3 | [] | no_license | #!/usr/bin/python
import numpy as np
from numba import jit
from scipy.interpolate import interp1d
from scipy.optimize import brentq
from scipy import optimize as opt
#-------------------------#
###########################
# PROFILING #
###########################
#-------------------------#
import time
... | true |
4ada1a3b0e0ea42c78e5c3290f7ce5e73d67599e | C-CCM-TC1028-102-2113/tarea-4-SantiGanda | /assignments/28Fibonacci/src/exercise.py | UTF-8 | 172 | 3.5625 | 4 | [] | no_license | num1=0
num2=1
num3=0
index=0
numfinal=int(input('Enter a number: '))
while index<numfinal:
num3=num1+num2
num1=num2
num2=num3
index=index+1
print(num1)
| true |
8828a008c8679192fbe143582956c7bd5117e790 | knightrohit/leetcode_july_challenge_2020 | /19_add_binary.py | UTF-8 | 1,436 | 3.5625 | 4 | [] | no_license | """
Time complexity = o(n)
Space complexity = O(1)
"""
class Solution:
def addBinary(self, a: str, b: str) -> str:
a, b = int(a, 2), int(b, 2)
return bin(a + b)[2:]
# Method - 2
"""
Time/Space complexity = o(n)
"""
class Solution:
def addBinary(self, a: str, b: str) -> str:
... | true |
402f9c50d6290fae12cee9dff0ecdeaeadc13749 | rab-ferrari/learning-academy-management | /src/common/engine.py | UTF-8 | 4,327 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""Main Engine and Thread Initialization
Implements thread module initialization by calling a single thread function.
"""
import os
import importlib
import common.trace
import common.params
_AUTO_MODULE_PATH = "auto.module"
_AUTO_FLOW_PATH = "auto.flow"
class Engine:
"""Main Engine - Flo... | true |
03456129e390eb68db07e2667e2ef05c7369c152 | Mattli8312/BrickBreaker | /BrickBreaker.py | UTF-8 | 5,465 | 2.921875 | 3 | [
"MIT"
] | permissive | import pygame
import random
pygame.init()
width = 200
height = 400
boxes = []
level = 1
LV = level
spd = 1
clock = pygame.time.Clock()
font = pygame.font.SysFont('Ariel', 20, True)
class cube:
def __init__(self, x, y, w, h, color):
self.x = x
self.y = y
self.w = w
sel... | true |
ac2400d0e6f0c3dd7ec629edf7778161340c88e3 | jadypamella/unb-blackjack | /agent/probabilistico.py | UTF-8 | 2,471 | 3.625 | 4 | [] | no_license |
"""
Classe com as funcoes para sugestoes probabilisticas
"""
class AgenteProbabilistico():
def __init__(self, player, dealer, deck):
self.name = "Probabilístico"
self.nickname = "prob"
self.player = player
self.dealer = dealer
self.deck = deck
self.suggestion = s... | true |
4c5c897d30c22b22890511220a99122e89c7e2dd | sith0008/NYC-TLC-Data-Pipeline | /preprocess.py | UTF-8 | 1,236 | 2.828125 | 3 | [
"MIT"
] | permissive | import geopandas as gpd
import pandas as pd
from tqdm import tqdm
from shapely.geometry import Point
from shapely.geometry.polygon import Polygon
import numpy as np
def main():
# part 1: split start and end
df = pd.read_csv('train.csv')
start = df[['id','vendor_id','pickup_datetime','pickup_longitude','pic... | true |
faea4d64f1c6a18dc6570ed3d920150e3c8bb939 | yaojia1990/print | /print_excel1.py | UTF-8 | 851 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020-08-09 12:10
# @Author : YaoJa
from time import sleep
import win32api
import win32print
from openpyxl.reader.excel import load_workbook
# filename = tempfile.mktemp(".txt") tempfile.mktemp 临时文件名
# excel文件绝对路径
file_home = "F:\工作\元器件整理.xlsx"
# 打开Excel文件... | true |
af15350ee8cbccf147b41a7097af818fbfd5dec7 | nageshkuba/TreeExtraction | /src/CNN.py | UTF-8 | 25,132 | 2.625 | 3 | [] | no_license | import os
import numpy as np
import theano
import theano.tensor as T
from theano.tensor.signal import downsample
from theano.tensor.nnet import conv
import cv2
from osgeo import gdal
from osgeo.gdalconst import *
from skimage.util.shape import view_as_windows
import time
NKERNS = (20, 50)
N_EPOCHS = 1
LEARNING_RATE =... | true |
8d4036e60ab821e68c8854e2394916c89513f114 | cenkayberkin/InterviewBitsArray | /plus1.py | UTF-8 | 605 | 2.9375 | 3 | [] | no_license | __author__ = 'cenk'
def plusOne(A):
remainder = 0
for i in range(0,len(A))[::-1]:
if i == (len(A) -1):
remainder = 1
if A[i] + remainder > 9:
remainder = 1
A[i] = 0
else:
A[i] = A[i] + remainder
remainder = 0
if remainder... | true |
8d32be64167c53e15c73df3c5f218f479816b344 | IPVL/Tanvin-PythonWorks | /chapter4/codes/dictionaryExp.py | UTF-8 | 666 | 3.65625 | 4 | [
"MIT"
] | permissive | #! /usr/bin/env python
# Dictionary example
people = {
'Alice': {
'phone': '2341',
'addr': 'Foo drive 23'
},
'Beth': {
'phone': '9102',
'addr': 'Bar street 42'
},
'Cecil': {
'phone': '3158',
'addr': 'Baz avenue 90'
}
}
labels = {
'phone': 'phone number',
'addr': 'address'
}
# get in... | true |
86cbf935dce6958ad2fbf71191b136fa92467afd | Aditya-Mehta1/SAT-GPA-Predictor | /Client.py | UTF-8 | 1,222 | 2.953125 | 3 | [] | no_license | import tkinter
import socket
from tkinter import *
#Client side socket
PORT = 50000
SERVER = socket.gethostbyname(socket.gethostname())
address = (SERVER, PORT)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(address)
def send(msg):
message = msg.encode('utf-8')
msg_length = len(mes... | true |
bc40b8fbc7e0746dff015235dac0162abfc5d407 | HugoVanhamme/assist | /assist/tasks/typeshare_coder.py | UTF-8 | 4,780 | 2.890625 | 3 | [] | no_license | '''@file typeshare_coder.py
contains the TypeShareCoder class'''
import numpy as np
from assist.tasks.read_task import Task
import coder
import random
class TypeShareCoder(coder.Coder):
''' a Coder that shares the places for args with the same type'''
def __init__(self, structure, conf):
'''Coder con... | true |
765f3ecc5af86c7230cf997b6077e07b569e93b1 | bnabe/self_tought | /ch14/challenge01.py | UTF-8 | 713 | 4.28125 | 4 | [] | no_license | class Rectangle:
def __init__(self, width, hight):
self.width = width
self.hight = hight
def calculate_perimeter(self):
return (self.width + self.hight) * 2
class Square:
square_list = []
def __init__(self, width):
self.width = width
self.square_list.append(width)
def calculate_perimeter(self):
ret... | true |
5ce37ffe501e6da3c2233252c60af491e5e2b6f1 | fjnajasm/PLN | /PRACTICA 2/Ejercicio 1.2.py | UTF-8 | 899 | 3.15625 | 3 | [] | no_license |
import nltk.data
import os
from time import time
from bs4 import BeautifulSoup
#Considero el summary y el body en los archivos
def devolverArchivos(ruta):
sentence_tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
totalOraciones = 0
numArchivos = 0
for archivo in os.listdir(ruta):
... | true |
191c39eaf2843059cfb6279c3e6a53e4d273c160 | alexmanul/python-first-touch | /loftblog/introduction/lesson04/If.py | UTF-8 | 238 | 3.609375 | 4 | [] | no_license | number = int(input('Введите число: \n'))
if number % 2 == 0:
print('Вы ввели чётное число')
else:
print('Вы ввели нечётное число')
print('Завершение программы')
| true |
d77c99896ccb95e81bc70d27f6ad562ef80b18df | Aravind2595/MarchPythonProject | /Operators/demo1.py | UTF-8 | 241 | 3.390625 | 3 | [] | no_license | #operators
#1.Arithmetic
#2.Relational
#3.Logical
#4.Compound assignment
#1.+,-,*,/,%,//,**
#read tow number and do multiplication
num1=int(input("Enter the number1"))
num2=int(input("Enter the number2"))
multi=num1*num2
print(multi)
| true |
aa135abf164cf3056d8b37bbd99566eb1707671e | romanticair/python | /basis/turtle-draw-demo/国际象棋盘.py | UTF-8 | 1,602 | 3.65625 | 4 | [] | no_license | import turtle
def polygon_by_triangle():
# 多三角构成的多边形
turtle.speed(10)
turtle.lt(60)
for i in range(6):
turtle.lt(60)
turtle.forward(50)
turtle.lt(90)
turtle.forward(86.6025404)
turtle.lt(150)
turtle.forward(100)
turtle.lt(120)
turtle.forw... | true |
02c44dd4f186b6cefb28ab3f5c5204f50aeb7c9a | mfgnik/18_price_format | /format_price.py | UTF-8 | 493 | 3.34375 | 3 | [] | no_license | import sys
def format_price(price):
try:
price_value = float(price)
except (ValueError, TypeError):
return None
error = 10 ** -6
if abs(price_value - int(price_value)) < error:
return '{:,}'.format(int(price_value)).replace(',', ' ')
else:
return '{}'.format(round(p... | true |
9b1eb5039b03ac9ee63ab7074fdc1bd2df773bb9 | gcvalderrama/Palantir | /worker/helper.py | UTF-8 | 2,984 | 2.984375 | 3 | [
"BSD-2-Clause"
] | permissive |
import os
import glob
import random
import shutil
class Helper:
def clean_file_name(self, source_folder, extension='txt'):
"""
Rename files
:param source_folder:
:param extension:
:return:
"""
news = glob.glob(source_folder + "/*." + extension)
for ... | true |
381f9972cb6f0e4954c8ae050a56006ea08bda25 | ThisIsPIRI/python-tools | /nurijach | UTF-8 | 1,563 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
"""누리자취
./nurijach example.com filename.kml
traceroute를 돌려서 나온 IP의 땅위자리(좌표)를 kml에 씁니다.
파일이름이 주어지지 않으면 <주소>.kml에 씁니다.
쓰기 앞서 API_ADDR를 바꾸거나 https://ip-api.com/docs/legal을 읽으세요
Change API_ADDR or read https://ip-api.com/docs/legal before using"""
import json
import re
import urllib.request as reque... | true |
0ee59b2062a573ce600dd5e618f648c7af2b42ce | Paradis4432/MyProyectsPython | /main.py | UTF-8 | 824 | 3.03125 | 3 | [] | no_license | import time
import pyautogui
import win32api
import win32con
import plotly.graph_objects as go
def showMousePos():
X, Y = pyautogui.position()
print("X: ", X, " Y: ", Y)
time.sleep(0.25)
def mouseClick(x, y):
win32api.SetCursorPos((x, y))
win32api.mouse_event(win32con.MOUSEEVE... | true |
542c5b353b64f13a7886d772db904ac7deaa6eb8 | Nisar-1234/Data-structures-and-algorithms-1 | /Backtracking/Find the K-th Permutation Sequence of first N natural numbers.py | UTF-8 | 892 | 4.1875 | 4 | [] | no_license | """
Input: N = 3, K = 4
Output: 231
Explanation:
The ordered list of permutation sequence from integer 1 to 3 is : 123, 132, 213, 231, 312, 321. So, the 4th permutation sequence is “231”.
"""
def permutate(l,arr,ans):
if l == len(arr)-1: # we are at last index it means that no more elements are there to... | true |
c3a17fc2ac28a034648f6b0bbc8d858517662a34 | scottwillmoore/ece3091 | /.old/experiments/test_motors/test_motors.py | UTF-8 | 843 | 2.890625 | 3 | [] | no_license | from device import Motor, RotaryEncoder, set_up, tear_down
from time import sleep
LEFT_MOTOR_DIRECTION_PIN = 6
LEFT_MOTOR_ENABLE_PIN = 13
LEFT_ENCODER_A_PIN = 9
LEFT_ENCODER_B_PIN = 11
ENCODER_RESOLUTION = 32
GEAR_RATIO = 344.2
WHEEL_TO_MOTOR_RATIO = ENCODER_RESOLUTION * GEAR_RATIO
MOTOR_TO_WHEEL_RATIO = WHEEL_TO_MO... | true |
a10c9bc0a39cdd3fad2121521d28bab579220172 | tonyechen/python-codes | /classVariable/main.py | UTF-8 | 244 | 3.421875 | 3 | [] | no_license | from car import Car
car_1 = Car("Chevy", "Corvette", 2021, "blue")
car_2 = Car("Ford", "Mustang", 2022, "red")
car_1.wheels = 2
print(car_1.wheels)
print(car_2.wheels)
print(Car.wheels)
Car.wheels = 2
print(car_1.wheels)
print(car_2.wheels) | true |
338a859acfe91bf07e88a0a22dd5d4b58bfb7789 | Badrivishal/CodeForcesPractice | /Python/Amr_and_Music.py | UTF-8 | 321 | 2.84375 | 3 | [] | no_license | n, k = input().split(" ")
n = int(n)
k = int(k)
d = list(map(int, input().split()))
a = [(d[i], i + 1) for i in range(len(d))]
s_a = sorted(a)
i = 0
sum1 = 0
while (sum1 <= k) and (i < len(a)):
sum1 += s_a[i][0]
i+=1
if(sum1 > k):
i-=1
print(i)
for iter1 in range(i):
print(s_a[iter1][1], end = " ")... | true |
3092d8d05755c33e814d940a4d314431c1f9ac07 | HydroFly/HydroflyGeneral | /testarea/callfile.py | UTF-8 | 169 | 2.859375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
from pin import setup
b=23
setup(b)
print("LED on")
GPIO.output(b,GPIO.HIGH)
time.sleep(5)
print("LED off")
GPIO.output(b,GPIO.LOW)
| true |
5f1e18918d88e70eaeae96fcadd1f071641d70ea | swaraleepanpatil/IOT | /day2/detectColor.py | UTF-8 | 722 | 2.765625 | 3 | [] | no_license | import numpy as np
import cv2
#webcamera no 0 is used to store frames
cap = cv2.VideoCapture(0)
cap.set(3,320) # set Width
cap.set(4,240) # set Height
while(1):
#capture live streams frame-by-frame
ret,frame = cap.read()
#converts image from BGR to HSV
hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)
... | true |