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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dae7db34d787038d614cefd334d84434184852af | Python | BetTom/learningpython | /C3/script1.py | UTF-8 | 185 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# @Author: jpch89
# @Email: jpch89@outlook.com
# @Time: 2018/7/27 19:44
# A first Python script
import sys
print(sys.platform)
print(2 ** 100)
x = 'Spam!'
print(x * 8)
| true |
2a74b31a1671619fa853e2c88f0f0ef1b42d3cf7 | Python | saulquispe/My-Solutions-to-The-Python-Workbook-By-Ben-Stephenson-122-of-174- | /Loop Exercises/ex79.py | UTF-8 | 2,571 | 4.625 | 5 | [] | no_license | '''
Exercise 79: Maximum Integer
This exercise examines the process of identifying the maximum value in a collection
of integers. Each of the integers will be randomly selected from the numbers between
1 and 100. The collection of integers may contain duplicate values, and some of the
integers between 1 and 100 ma... | true |
bdcac9f4abf1123f30d7e6a2c67262ce7fcafbfb | Python | suresh-boddu/algo_ds | /ds/arrays/queue_demo.py | UTF-8 | 1,332 | 3.265625 | 3 | [] | no_license | from ds.arrays.queue import AQueue
from ds.arrays.queue import Queue
def list_queue_demo():
print "Queue Demo using List\n"
queue = Queue()
queue.insert(1)
queue.insert(2)
queue.insert(3)
queue.insert(4)
queue.insert(5)
queue.display()
print "Deleted: " + str(queue.delete())
p... | true |
1a4276d91efd73dd6ad5a1b12ed631dd32806106 | Python | HiroshiMatsumoto/100NLPPractice | /052.py | UTF-8 | 2,443 | 3.34375 | 3 | [] | no_license | #! /usr/bin/env python
# -*- encoding:utf-8 -*-
#(52) 形態素を表すクラスMorphを実装せよ.このクラスは表層形(surface),基本形(base),品詞(pos),品詞細分類1(pos1)をメンバ変数に持つこととする.さらに,(51)の解析結果を1文毎に読み込み,1文をMorphオブジェクトのリストとして表現し,適当に表示するプログラムを実装せよ.
import MeCab
from HiroshiLib import *
from collections import defaultdict
class Morph:#needs: import MeCab
#p... | true |
25df647a9fa7fcac55b5b074e3115c3ef57943ca | Python | nubol23/thesis-document | /codigos/apendices/juncs.py | UTF-8 | 1,534 | 2.890625 | 3 | [] | no_license | import pandas as pd
import os
from shutil import copy
from tqdm import tqdm
if __name__ == '__main__':
df = pd.read_csv('path/to/train_dataset.csv')
# Crear colúmnas para la carpeta y el archivo
df['folder'] = [f.split('/')[0] for f in df['filenames'].tolist()]
df['file'] = [f.split('/')[1].split('.')[0] for ... | true |
d1581f19896563badac5db60ec40b68be2c5d701 | Python | WaterH2P/Algorithm | /LeetCode/1251-1500/1496 massage.py | UTF-8 | 907 | 3.671875 | 4 | [] | no_license | # 【简单】1496. 面试题 17.16. 按摩师
class Solution:
def massage(self, nums) -> int:
if len(nums) == 0: return 0
if len(nums) == 1: return nums[0]
if len(nums) == 2: return nums[0] if nums[0] > nums[1] else nums[1]
if len(nums) == 3:
return nums[0] + nums[2] if nums[0] + nums[2] >... | true |
dc191703618b0a714bac506ae45615f7d38bf16d | Python | Ti1mmy/ICS-201 | /Drawing with loops/Loops exercise.py | UTF-8 | 354 | 4.21875 | 4 | [] | no_license | """
# 1.
sum = 0
for i in range(10):
i = int(input('Please enter a number: '))
sum += i
print(sum)
"""
#2
vowels = 'aeiouAEIOU'
total = 0
for i in range(10):
i = input('Please type in a letter: ')
if i == '':
num = 0
elif i in vowels:
num = 1
else:
num =... | true |
f77a4ae26d0f60c48fc3420661019029aa35f700 | Python | solapark/pcl | /morph_filter.py | UTF-8 | 1,720 | 2.5625 | 3 | [] | no_license | from scipy import ndimage
import numpy as np
def morph_bridge(img) :
filter_list = list()
#filter_list.append(np.array([[1,0,1], [0,0,0], [0,0,0]]))
filter_list.append(np.array([[1,-1,-1], [-1,0,1], [0,0,0]]))
#filter_list.append(np.array([[1,0,0], [0,0,0], [1,0,0]]))
filter_list.append(np.array([... | true |
273833af8e3a8353ea67d73a7f635562db1174aa | Python | nagendrakamath/1stpython | /python.py | UTF-8 | 1,056 | 4.03125 | 4 | [] | no_license | print ("hello wold")
print (2)
print (f"20 days are {20 * 24 * 60} min" )
print (f"50 days are {50 * 24 * 60} min" )
print (f"80 days are {80 * 24 * 60} sec" )
calculation_to_unit = 24
name_of_unit ="hours"
def days_to_units(num_of_days):
print (f"{num_of_days} days are {num_of_days * calculation_to_unit} {name_o... | true |
072b9f76c687665be02f987150743fdf24feeb49 | Python | hisoyem/sk-energy-back | /modules/email_sender.py | UTF-8 | 4,060 | 2.65625 | 3 | [] | no_license | import smtplib
import aiosmtplib
import os
import mimetypes
from email import encoders
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.audio import MIMEAudio
from email.mime.multipart import MIMEMultipart
async def send_email(addr_to, m... | true |
e39f7326e87fe30088c6e6ffc08aab6337778729 | Python | ezekie97/Connect5-AI-Project | /Connect_5/src/board_node.py | UTF-8 | 845 | 3.828125 | 4 | [] | no_license | __author__ = 'Bill'
class BoardNode:
"""
Nodes used in the Minimax algorithm. Each node contains a board, a heuristic value,
and zero or more children.
"""
def __init__(self, board, heuristic):
"""
Create a BoardNode for the minimax algorithm
:param board: this node's boar... | true |
f7debf400171abf8685f7bed6f93bc88c61038fb | Python | abhijitdey/coding-practice | /fast-track/dynamic_programming/6_longest_common_subsequence.py | UTF-8 | 615 | 4.15625 | 4 | [] | no_license | """
Given two sequences, find the length of longest subsequence present in both of them. A subsequence is a sequence that appears in the same relative order,
but not necessarily contiguous.
For example, “abc”, “abg”, “bdf”, “aeg”, ‘”acefg”, .. etc are subsequences of “abcdefg”
"""
def LCS(x, y, m, n):
if m <= 0... | true |
e6099f07dc37492d269e059340646c9c957fcdd3 | Python | bayramcicek/language-repo | /p053_more_on_functions.py | UTF-8 | 3,077 | 4.1875 | 4 | [
"Unlicense"
] | permissive | #!/usr/bin/python3.6
# created by cicek on 13.09.2018 22:19
'''
Python allows to have function with varying number of arguments. Using *args as
a function parameter enables you to pass an arbitrary number of arguments to
that function. The arguments are then accessible as the tuple args in the body
of the function.
''... | true |
278205aad7ae3b5618494af5243f31dca3b72029 | Python | Taoge123/OptimizedLeetcode | /LeetcodeNew/python2/LC_1656.py | UTF-8 | 378 | 3.578125 | 4 | [] | no_license |
class OrderedStream:
def __init__(self, n: int):
self.values = {}
self.pointer = 1
def insert(self, id: int, value: str):
self.values[id] = value
res = []
while self.pointer in self.values:
# print(self.values)
res.append(self.values.pop(self.poi... | true |
b219cc9406d74599cfe3a82da29aac92cbb2cbe8 | Python | rachidmaalme/webappl | /userchat/forms.py | UTF-8 | 1,206 | 2.515625 | 3 | [] | no_license | from django import forms
from .models import Personne
class LoginForm(forms.Form):
email=forms.EmailField(label='courriel')
password = forms.CharField(label ='mot_de_passe')
def clean(self):
cleaned_data = super(LoginForm,self).clean()
email = cleaned_data.get("email")
password = cl... | true |
267519a07c83f46ac4a30b390153955f328df653 | Python | subramon/Q | /RUNTIME/DNN/python/from_boris/b_dnn.py | UTF-8 | 21,742 | 2.8125 | 3 | [
"MIT"
] | permissive | import h5py
import numpy as np
import pandas as pd
from PIL import Image
from sklearn.datasets import make_blobs
from sklearn.metrics import log_loss
from sklearn.preprocessing import MinMaxScaler
# ----------------------------------------------------------------------
# Preprocess data
# ---------------------------... | true |
50daddc25b0ff62969ecd6d14917fbb94a2d5922 | Python | areum-choe/PycharmProjects | /pythonProject/BOJ/1~50단계/인공지능시계.py | UTF-8 | 200 | 3.078125 | 3 | [] | no_license | a,b,c=map(int,input().split())
d=int(input())
if c+d>=60:
b+=(c+d)//60
e=(c+d)%60
if b>=60:
a+=b//60
b=b%60
if a>23:
a-=24
else:
e=c+d
print(a,b,e) | true |
ee2d986760313a27ecb46bfebc7bcb3ed48164cd | Python | andrewfowlie/veltropy | /veltropy/form_factor.py | UTF-8 | 863 | 3.0625 | 3 | [
"MIT"
] | permissive | """
Helm form-factor.
"""
import numpy as np
from numpy import exp, sin, cos, pi
GEV_TO_INVERSE_FM = 1.E-6 / 1.973E-7
S = 0.9
a = 0.52
C1 = 1.23
C2 = 0.6
def helm_form_factor(q, A=130):
"""
@param q Momentum in GeV
@param A Nucleon number
@returns Form factor
"""
q *= GEV_TO_INVERSE_FM
... | true |
26c1d9de66092c3a711182d040c9d72fc9dba9c2 | Python | Mik3Mon/edd_1310_2021 | /14enero_1310/pruebas_arboles.py | UTF-8 | 472 | 3.734375 | 4 | [] | no_license | class NodoArbol:
def __init__(self , value , left = None , right = None):
self.data = value
self.right = right
self.left = left
arbol = NodoArbol("R" , NodoArbol("C") , NodoArbol("H"))
print(arbol.left.data)
print(arbol.data)
arbol2 = NodoArbol(4 , NodoArbol(3 , NodoArbol(2 , NodoArbol(2... | true |
52e0b1b07562ea6ac4095dc95bbd72c2ae71f2dc | Python | hristo-grudev/attijariwafabankeg | /attijariwafabankeg/spiders/spider.py | UTF-8 | 1,226 | 2.609375 | 3 | [] | no_license | import scrapy
from scrapy.loader import ItemLoader
from ..items import AttijariwafabankegItem
from itemloaders.processors import TakeFirst
class AttijariwafabankegSpider(scrapy.Spider):
name = 'attijariwafabankeg'
start_urls = ['https://www.attijariwafabank.com.eg/news/']
def parse(self, response):
post_links... | true |
b50f9776a9437f332a5fbf44914f222ffc9ae91b | Python | jfarrellhfx/variational-monte-carlo | /scripts/hydrogen_molecule_analysis.py | UTF-8 | 924 | 2.59375 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
# Matplotlib Parameters
plt.rc('text', usetex=True)
plt.rc('font', family='serif', size=10)
data = np.load("hydrogen_molecule.npz")
alphas = data["alphas"]
ds = data["ds"]
energies = data["energies"]
standard_dev = data["standard_dev"]
i = np.where(np.min(energies)... | true |
c420d1416fae6ff89e15da13575f7b7fe2159c88 | Python | mxl1990/GAN | /model_mnist.py | UTF-8 | 8,710 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow.python import debug as tfdbg
import numpy as np
from util import normalize_image, denormal_image, random_data, save_images
from scipy.misc import imsave
class GAN(object):
def __init__(self, sess, input_dim, gen_layer_dim, dis_layer_dim):
se... | true |
318f7f29e14732f63cc5fe3ab45f43746c754141 | Python | bangyuwen/comic_scrap_update_info | /comic_scrap/comic_scrap/spiders/dm5.py | UTF-8 | 3,362 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
import unittest
from datetime import datetime, time, timedelta
from time import sleep
import pytz
import scrapy
from selenium import webdriver
from scrapy.selector import Selector
class Dm5Spider(scrapy.Spider):
name = 'dm5'
allowed_domains = ['dm5.com']
start_urls = ['h... | true |
12bec5d57c6f4674fb8d62322d4858a653e1d360 | Python | saxAllan/gaei1 | /release/multi_judge(failed).py | UTF-8 | 2,400 | 2.609375 | 3 | [] | no_license | print("\n========================================")
print(" judgements Ver. 1.26 (20191126)")
print("========================================\n")
import input
import numpy
import statistics
import concurrent.futures
def modecalc(mode_org, nokori):
for k in range(150):
mode = mode_org[k][0]
... | true |
74739d62d56b8e16a6870de02ec8fd75a098a0af | Python | Armaniii/Ovarian-Cancer-Prediction | /peak_finder.py | UTF-8 | 17,360 | 3.4375 | 3 | [] | no_license | # Copyright 2017, Lars G.
"""A demo implementation of a peak finding algorithm."""
import numpy as np
class PeakFinder:
"""Find and filter peaks inside a vector.
Parameters
----------
vec : np.ndarray
Vector to search.
distance : int
Required minimal distance between peaks in ... | true |
dd8abc08290f8db795af6acc0983abd2ca2697e3 | Python | ParanoidAndroid19/Common-Patterns_Grokking-the-Coding-Interview | /3. Fast & Slow Pointers/3_Happy Numbers (medium).py | UTF-8 | 1,100 | 3.84375 | 4 | [] | no_license |
# My Solution: Recursive approach
# dictSums = {}
# def happyNumbers(digits):
# sqSum = 0
# for d in digits:
# sqSum = sqSum + d**2
# if(sqSum == 1):
# return True
# elif dictSums.get(sqSum, 0) == 1:
# return False
# else:
# dictSums[sqSum] = 1
#... | true |
dac87df4a577db184b62564ccafb4c6fbf3d4c20 | Python | mgbrouli/Games.Exercicios | /Jogo JO KEM PO.py | UTF-8 | 1,015 | 3.90625 | 4 | [] | no_license | from random import randint
from time import sleep
lista = ['pedra', 'papel', 'tesoura']
def escolha(item, ganha, perde):
if player == item and lista[pc] == ganha:
print(f'Você escolheu {item} o computador escolheu {ganha}')
print(f'Parabéns você ganhou!!!')
elif player == item and lis... | true |
f42101f4aee77d966844dfa3f2cf00a8ddee06bd | Python | VarunVedant/mwdb-project | /phase1_main.py | UTF-8 | 456 | 3.46875 | 3 | [] | no_license | """
Phase 1 Project's main code
"""
import sys
import task1
import task2
import task3
def main():
while True:
print('Choose which task u want to execute: \n(Note - Execute Task 2 before Task 3)')
ch = input('\n1. Task 1\n2. Task 2\n3. Task 3\n4. Exit\nEnter Choice: ')
if ch == '1':
task1.task1()
elif ch ==... | true |
af3bd4ed6ed9cdc156ec6a18e862a13c4e64cd29 | Python | mankarali/PYTHON_EDABIT_EXAMPLES | /45_fullname_email_CLASS.py | UTF-8 | 1,737 | 4.375 | 4 | [] | no_license | """
Fullname and Email
Create the instance attributes fullname and email in the Employee class. Given a person's first and last names:
Form the fullname by simply joining the first and last name together, separated by a space.
Form the email by joining the first and last name together with a . in between, and follow i... | true |
756bdc9424bc3b483275abe9c02961d45920c344 | Python | Rinatik79/PythonAlgoritms | /Lesson 2/lesson2-5.py | UTF-8 | 251 | 3.328125 | 3 | [] | no_license | current = 32
line = ""
counter = 0
while current <= 127:
line += str(current) + " " + chr(current) + "\t"
current += 1
if counter != 9:
counter += 1
else:
counter = 0
print(line)
line = ""
print(line)
| true |
0f697eb2b260acf2c38aa0f9b05d0ef7083fe510 | Python | dexterpengji/practice_python | /sensorRead/GPS.py | UTF-8 | 931 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import serial
import pynmea2
import time
def parseGPS(data):
flag_parse = "GGA"
if data.find(flag_parse) > 0:
try:
msg = pynmea2.parse(data)
time_SYS = time.strftime('%Y%m%d-%H%M%S', time.localtime())
time_GPS = msg.timestamp
posi_LAT = "%s%s" % ('-' if msg.lat_dir ==... | true |
b5ea6f795e798fdd17e1c8b6da97ae5726a1b091 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/3982.py | UTF-8 | 520 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
f = open('/dev/stdin', 'r')
def is_tidy(n):
return n == ''.join(sorted(n))
N = int(f.readline())
i = 1
for _ in range(N):
t = map(int, f.readline().strip())
while not is_tidy(''.join(map(str, t))):
for p in xrange(len(t) - 2, -1, -1):
if t[p] > t[p + 1]:
... | true |
c13dafc97d5eec489178349be944242e6fb59faf | Python | martinmaillard/excellence | /excellence/core.py | UTF-8 | 5,558 | 3.21875 | 3 | [] | no_license |
from collections import UserList
import xlsxwriter
from .datastructures import DefaultList
from .exceptions import ImmutableCellError, InvalidGrid
class Workbook(xlsxwriter.Workbook):
"""Wrapper around :class:`xlsxwriter.Workbook` that provides to worksheets
a reference to their parent workbook.
"""
... | true |
64692a542c345181d82a50c9f802d38f3deae04d | Python | jlefkoff/GridBoard | /converted-gifs/originals/gif_test.py | UTF-8 | 1,438 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import time
import sys
from rgbmatrix import RGBMatrix, RGBMatrixOptions
from PIL import Image, ImageSequence, GifImagePlugin
# Matrix size
size = 128, 128
# Open source
if len(sys.argv) < 2:
sys.exit("Require an image argument")
else :
image_file = sys.argv[1]
im = Image.open(image_file)... | true |
40aab0faa41780759d0524bcb698e1ddb35d3448 | Python | thesmiley1/gazoo | /src/gazoo/backup_file.py | UTF-8 | 1,383 | 2.921875 | 3 | [
"MIT"
] | permissive | """
Provide class BackupFile.
"""
from __future__ import annotations
from errno import ENOENT
from pathlib import Path
from .util import Util
class BackupFile:
"""
Provide convenience properties for backup files.
"""
def __init__(self: BackupFile, path_fragment: str, length: int) -> None:
... | true |
7b318d713ebfae3698824f12cff6655836d13689 | Python | LYTXJY/python_full_stack | /Code/src/hellopython/第二章/第二章作业/2.6.py | UTF-8 | 1,398 | 4.78125 | 5 | [] | no_license | #2.6(对一个整数中的各位数字求和)编写一个程序,读取一个0到1000之间的整数并计算它各位数字之和。
#例如:932,9+3+2=14
#提示:使用%(取余,得到余数)来提取数字
# 使用//(整除)运算符去除掉被提取的数字。
# 932 % 10 = 2, 932 // 10 = 93
# num = eval(input("Enter a number between 0 and 1000: "))
# p1 = num // 100#9
# p2 = (num -p1 * 100) // 10 #3
# p3 = (num -p1 * 100 - p2 * 10) // 1... | true |
10f58896d462b18cf66924ea03530edb420f2c86 | Python | CrzRabbit/Python | /leetcode/1248_M_统计「优美子数组」.py | UTF-8 | 1,213 | 3.578125 | 4 | [] | no_license | '''
给你一个整数数组 nums 和一个整数 k。
如果某个 连续 子数组中恰好有 k 个奇数数字,我们就认为这个子数组是「优美子数组」。
请返回这个数组中「优美子数组」的数目。
示例 1:
输入:nums = [1,1,2,1,1], k = 3
输出:2
解释:包含 3 个奇数的子数组是 [1,1,2,1] 和 [1,2,1,1] 。
示例 2:
输入:nums = [2,4,6], k = 1
输出:0
解释:数列中不包含任何奇数,所以不存在优美子数组。
示例 3:
输入:nums = [2,2,2,1,2,2,1,2,2,2], k = 2
输出:16
提示:
1 <= nums.length <= ... | true |
3cd9b0dee213f1a1604deb2e7e6d7196ca0b51d1 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/rna-transcription/00a716795bd1430fa8506bee075cba05.py | UTF-8 | 145 | 3 | 3 | [] | no_license | def to_rna(dna_in):
dna = "ACGT"
rna = "UGCA"
dna_to_rna = str.maketrans(dna,rna)
return (dna_in.translate(dna_to_rna))
| true |
880cff2bf89afb7d85ff17fb3c993bded7ce6e1d | Python | LennyBoyatzis/compsci | /problems/reverse_string.py | UTF-8 | 659 | 4.28125 | 4 | [] | no_license | from typing import List
def reverse_string(string: List) -> List:
"""Reverses a string
Args:
string: any string
Returns: a reversed string
"""
# Copy of list in reversed order
# string[::-1]
string_len = len(string)
left_index = 0
right_index = string_len - 1
while... | true |
92fdca1a789b5c1fe89a0dfd231ad3ea7b690e88 | Python | dragondjf/pyutil | /util.py | UTF-8 | 2,435 | 3.515625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
class KeyedTuple(tuple):
"""``tuple`` subclass that adds labeled names.
E.g.::
>>> k = KeyedTuple([1, 2, 3], labels=["one", "two", "three"])
>>> k.one
1
>>> k.two
2
Result rows returned by :class:`.Query` that contain multiple
ORM enti... | true |
62ff3bae89e049bd4d5eb52b3819f0433ecb6c5d | Python | jamtibaes/TestInit | /example_03.py | UTF-8 | 1,234 | 4.125 | 4 | [] | no_license | # Pete likes to bake some cakes. He has some recipes and ingredients.
# Unfortunately he is not good in maths.
# Can you help him to find out, how many cakes he could bake considering his recipes?
# Write a function cakes(), which takes the recipe (object) and the available ingredients (also an object) and returns t... | true |
a8918a737f01d0ddfed9094d008def13863f29a3 | Python | KushagrJ/PY-00 | /01/01.py | UTF-8 | 428 | 4.46875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# Python 3.8.6
a = 10
b = 13
c = a+b
print("The sum of", a, "and", b, "is", c)
# /* Trivia - 01.py
#
# * a = a+22 will add 22 to the current value of a and assign the sum to a. So,
# print(a) will now print 32, instead of 10.
# * To execute multiple commands in the same line, semico... | true |
a9b29b395d5288b0c34cc5a7d86f04ed10498f5d | Python | IpursueI/tencent_mini | /mini/pet/login.py | UTF-8 | 2,348 | 2.65625 | 3 | [] | no_license | #-*- coding:UTF-8 -*-
from django.http import HttpResponse
import models
import util
import json
import hashlib
import datetime
import time
'''
登陆功能:by stanwu, 2016/06/25
post参数名:method
post参数内容:{"name":"login", "args":{"user_id":"15666666666", "user_password":"123"}}
服务器返回值(json格式):
注册成功:
{"r... | true |
86e0460fd70cca80af63e0c7b9482aaa45bff52e | Python | kdragonkorea/TIL | /Bigdata_analysis_course_20201228/2_Python/Python_exam/day3(20210106)/forLab4.py | UTF-8 | 1,479 | 4.53125 | 5 | [] | no_license | # [ 실습 4 ]
# evenNum 변수와 oddNum 변수의 값을 0으로 대입한다.
# 1 부터 100 까지의 값 중에서 짝수의 합은 evenNum 에 누적하고 홀수의 합은 oddNum 에 누적한다.
# 수행 결과는 다음과 같이 출력한다.
#
# 1부터 100까지의 숫자들 중에서
# 짝수의 합은 XXX 이고
# 홀수의 합은 YYY 이다.
# 2021-01-09 풀이2 (코드리뷰와 동일함)------------------------------------
evenNum = 0
oddNum = 0
for i in range(1, 101):... | true |
7286b008717253b207227bea6875d90528cb5d51 | Python | gksrb2656/AlgoPractice | /A대비/블랙잭.py | UTF-8 | 868 | 2.765625 | 3 | [] | no_license | # N, M = map(int, input().split())
# cards = list(map(int, input().split()))
# cards.sort()
# sub = M
# sum_cards = 0
# for i in range(N):
# for j in range(i+1,N):
# if cards[i] + cards[j] >= M:
# continue
# for k in range(j+1,N):
# if M - cards[i] - cards[j] - cards[k] >= 0:... | true |
2798e000c9b6a4756118fb12a86bc63e5e0d2d4a | Python | hmccreanor/linearprogramming | /simplex.py | UTF-8 | 1,628 | 2.703125 | 3 | [
"Unlicense"
] | permissive | from math import inf
import numpy as np
from lExpParser2 import Tableu
import sys
inFile = sys.argv[1]
# Supress divide by 0 warnings
np.seterr(divide="ignore")
t = Tableu(inFile)
tableu = t.tableu
slack_start_index = t.slack_start_index
variables = t.variables
constraint_index = tableu.shape[1] - 1
bottom_index = ... | true |
4eb1feb9ad889959446f982b1007ba2646c3f790 | Python | JinChengZ18/Learning-Materials-of-SMSE | /大三下/2021华罗庚杯校内赛题目/working_folder/networkx/networkx1.py | UTF-8 | 224 | 2.96875 | 3 | [
"MIT"
] | permissive | import networkx as nx
G = nx.Graph()
G.add_edge('A', 'B', weight=4)
G.add_edge('B', 'D', weight=2)
G.add_edge('A', 'C', weight=3)
G.add_edge('C', 'D', weight=4)
print(nx.shortest_path(G, 'A', 'D', weight='weight'))
| true |
424cb4ab8bef5f196186134291fc8b01e235243c | Python | nolngo/Poetry-Slam | /Poetry-slam.py | UTF-8 | 2,445 | 4.1875 | 4 | [] | no_license | filename = "poem.txt"
def get_file_lines(filename):
read_poem = open(filename, 'r')
return read_poem.readlines() #this function has outputted a list version of the text file! We can now reference it in following functions
#print(get_file_lines(filename)) #this is to test the return output of the get_... | true |
9a42cb6b0f7ecf7b5e34435e10114bd15ca780e5 | Python | DusanSulan/Earthquake | /UtilsEQ.py | UTF-8 | 17,392 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 11 21:47:47 2019
@author: Dusan Sulan
"""
import random
from sklearn.model_selection import train_test_split
import xgboost as xgb
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler
from sklearn.svm imp... | true |
5fdb6f9b4c813cd9d2a2812f2489eb302573a887 | Python | AayushSabharwal/Python-Backup | /Assignments/Home Assignment 6/Q4.py | UTF-8 | 148 | 2.8125 | 3 | [] | no_license | import random
def biasedcoin():
ans = random.randint(0, 3)
if(ans == 0):
return 'H'
else:
return 'T' | true |
f847affbd8192e7f4d063f84eae538d5741e24f8 | Python | NevzatBOL/ROS-Beginner | /catkin_ws/src/beginner_tutorials/scripts/message.py | UTF-8 | 446 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import rospy
from beginner_tutorials.msg import Num
def talker():
rospy.init_node('message_talker',anonymous=True)
pub = rospy.Publisher('talker',Num)
r = rospy.Rate(10)
msg = Num()
msg.num = 4
while not rospy.is_shutdown():
rospy.loginfo(msg)
pub.publ... | true |
173dec54e5e37397f2af706bbe7dede9b3a0e701 | Python | andreasvc/readability | /readability/__init__.py | UTF-8 | 10,359 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | """Simple readability measures.
Usage: %(cmd)s [--lang=<x>] [FILE]
or: %(cmd)s [--lang=<x>] --csv FILES...
By default, input is read from standard input.
Text should be encoded with UTF-8,
one sentence per line, tokens space-separated.
Options:
-L, --lang=<x> Set language (available: %(lang)s).
--csv ... | true |
4215bfbe19490607adab6912154bba4bb60a6f31 | Python | JacProsser/college | /Assignment 1 - Procedural Programming/Python Challenges (1-30)/Challenge 6.py | UTF-8 | 393 | 3.921875 | 4 | [] | no_license | #asking user what their name is
name = input("What is your name? ")
#defining that "your_name" = the users input
your_name = name
#printing hello with the users name
print("Hello", your_name)
#printing the memory location of the users input
print("Memory Location: ", id(your_name))
#gets user to press enter before clos... | true |
88d4b65459979fbeeb05ff0ce60ce2f4c41efc55 | Python | varun1210/Two-Phase-Caching | /Code.py | UTF-8 | 5,232 | 2.546875 | 3 | [] | no_license | import pandas as pd;
from pandas import DataFrame as df;
import random;
from openpyxl import Workbook;
from openpyxl import load_workbook;
shortTermCache = set();
shortTermCacheCapacity = 5;
longTermCache = set();
hitRatio = [0];
longTermCacheCapacity = 2 * shortTermCacheCapacity;
registerData = {};
regist... | true |
9007fa40a71875ec5bc478291dc74bd887c89832 | Python | robomechanics/clifford_sim | /scripts/plotter.py | UTF-8 | 250 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
import math
import matplotlib as plt
# Displaying the contents of the text file
file = open("/home/akshit/clifford_sim_ws/src/clifford_sim/data/file1.txt", "r")
content = file.read()
print(type(content)) | true |
86fe1c4180e86a53cadc2239cdcd0c816ddf4a41 | Python | mfilipelino/python-notes | /problems/tests/test_multiplos.py | UTF-8 | 347 | 2.71875 | 3 | [] | no_license | from unittest import TestCase
from problems.multiples import multiples
class TestMultiplos(TestCase):
def test_base(self):
self.assertTrue(multiples(6, 24))
self.assertFalse(multiples(6, 25))
self.assertFalse(multiples(7, 3))
self.assertTrue(multiples(4, 36))
self.assertT... | true |
f9d651b86e0c6cbaf1dcf43f1427e19d0ab5dc30 | Python | ManishSingla97/Face_rec | /face_location.py | UTF-8 | 815 | 2.84375 | 3 | [] | no_license | from PIL import Image, ImageDraw
import numpy as np
from face_recognition import *
import os
def load_image_file(file, mode='RGB'):
im = Image.open(file)
if mode:
im = im.convert(mode)
return np.array(im)
def face_location(img_path):
img = load_image_file(img_path)
location = face_loc... | true |
aefe0544fa05b909a1eaf5d89a50122ed9a7e876 | Python | ananastasiia-cz/18bi-2020 | /assignments/ts_Kuznetsova.py | UTF-8 | 10,003 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Monthly milk production
# First, let's load a data:
# In[22]:
# separate out a validation dataset
from pandas import read_csv
series = read_csv('milk.csv', header=0, index_col=0, parse_dates=True, squeeze=True)
split_point = len(series) - 12
dataset, validation = series[0... | true |
3fc25297ded6f2c88678caab0fe1ac7e4a196bd1 | Python | SecretHamster/circular_route | /path.py | UTF-8 | 726 | 3.578125 | 4 | [] | no_license |
class Node():
def __init__(self, icao):
self.name = icao
self.distance = -1
self.next_hop = None
def __str__(self):
return "{} is distance {} via {}".format(self.name, self.distance, self.next_hop)
def set_next_hop(self,icao,distance):
if self.distance > distance o... | true |
8ce9fa12e5616a36f17159f8d8e03770a682121d | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2555/60627/275454.py | UTF-8 | 1,099 | 2.859375 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
#include <algorithm>
#define N 30000
#define ll long long
using namespace std;
struct arr
{
int a,b;
}p[N];
ll a1[N],a2[N],c[N],ans;
int n;
int so(arr x,arr y)
{
if (x.a==y.a) return x.b>y.b;
return x.a<y.a;
}
ll sum1(ll x)
{
ll s=0;
while (x>0)
{
... | true |
d0bfb4202d68b9fdf65d607b3d2fb49a9c262b8a | Python | vijaybhaskar3030/VijayPython | /Second.py | UTF-8 | 391 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 8 18:17:29 2018
@author: REIU257
"""
length =1.10
width = 2.20
area = length*width
print ("the length is:", length)
print ("the width is:", width)
print ("the area is:", area)
print ("the length is:", length,"the width is:",width,"and the area is:",area)
the_world_is_... | true |
df9cec34386c3afacf0e9fd581da3ee36d899c3a | Python | runalb/Python-Problem-Statement | /PS-1/ps16.py | UTF-8 | 375 | 4.65625 | 5 | [] | no_license | # PS-16 WAP to test whether a passed letter is a vowel or not
str = input("Enter String: ")
vowel = "AEIOUaeiou"
#loop x through str to get each ch in variable x
for x in str:
#check if x is present in vowel
if x in vowel:
#if x is vowel
print(x, "is vowel")
#else x is not a... | true |
29b8a8c187f1ce7781a331c33e0594f6f3d86532 | Python | fwalch/dmlab | /plot_landmarks_for_emotions.py | UTF-8 | 2,730 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import os
DATA_DIR = 'data'
IMAGES_DIR = os.path.join(DATA_DIR, 'cohn-kanade-images')
EMOTIONS_DIR = os.path.join(DATA_DIR, 'Emotion')
FACS_DIR = os.path.join(DATA_DIR, 'FACS')
LANDMARKS_DIR = os.path.join(DATA_DIR, 'Landmarks')
UNKNOWN_EMOTIO... | true |
592037c6a0c27440f9534446d67cb114e7ad9ac1 | Python | Nocks/ReadBooks | /library/models.py | UTF-8 | 2,476 | 2.671875 | 3 | [
"MIT"
] | permissive | from django.db import models
from django.contrib.auth.models import User
class Author(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
def __str__(self):
return '{} {}'.format(self.first_name, self.last_name)
class Book(models.Model):
t... | true |
26d5260df329b577b31779c85cd1d25ecd94a91e | Python | jeon-chanhee/DataScience | /Python/basic/python_day6/python06_18_DataTypeEx03_전찬희.py | UTF-8 | 500 | 3.6875 | 4 | [] | no_license |
a = 3
b = 3
print('a is b :', a is b)
print('a == b :', a==b)
print(id(a))
print(id(b))
'''
id(a)의 값이 id(b)의 값과 동일함을 확인할 수 있음. 즉 a가 가리키는 대상과 b가 가리키는 대상이
동일하다는 것을 알 수 있다. 동일한 객체를 가리키고 있는지에 대해서 판단하는 파이썬 명령어 is를
다음과 같이 실행해도 역시 참(True)을 돌려준다.
'''
# 똑같은 값을 설정하면 주소도 동일함 | true |
d4c2ebe5be3b75c5d36d7dfe8b4cefe4c772cc58 | Python | Junga-a/Algorithm-Python | /Quick Sort(2).py | UTF-8 | 614 | 3.71875 | 4 | [] | no_license | array=[5,7,9,0,3,1,6,2,4,8]
def quick_sort(array):
if len(array)<=1: #리스트가 하나 이하의 원소만 담고 있다면 종료
return array
pivot=array[0] #피벗은 첫번째 원소
tail=array[1:] #피벗을 제외한 리스트
left_side=[x for x in tail if x<=pivot] #분할된 왼쪽 부분
right_side=[x for x in tail if x>pivot] #분할된 오른쪽 부분
#분할된 이후 왼쪽 부분과 ... | true |
57696f5d05b15840bf24b4f9b4ec0d1bd8773afd | Python | sergei-doroshenko/P030_coursera | /python/_2_data_structures/_2_priority_queues_and_disjoint_sets/job_queue.py | UTF-8 | 5,432 | 3.515625 | 4 | [] | no_license | # python3
# Good job! (Max time used: 3.70/6.00, max memory used: 35385344/536870912.)
class JobQueue:
def read_data(self):
self.num_workers, m = map(int, input().split())
self.jobs = list(map(int, input().split()))
# self.num_workers, m = 2, 5
# self.jobs = [1, 2, 3, 4, 5]
... | true |
c2a4170bf3b5790bd4e12b8f40724d30ca97f50a | Python | IGDEXE/Python | /PythonBrasil/EstruturaSequencial/IMC S.py | UTF-8 | 538 | 4.65625 | 5 | [
"MIT"
] | permissive | # Tendo como dado de entrada a altura (h) de uma pessoa, construa um algoritmo que calcule seu peso ideal, utilizando as seguintes fórmulas:
# Para homens: (72.7*h) - 58 | Para mulheres: (62.1*h) - 44.7
# Ivo Dias
# Recebe a altura
altura = int(input("Informe a sua altura: "))
# Calcula o peso
pesoIdealHomem = (72.7 ... | true |
cca23f49db44c4bb9c4e0351be0fc4b82e782856 | Python | kimjh4930/m-learning | /project/drawline.py | UTF-8 | 1,419 | 3 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
from sklearn.datasets.samples_generator import make_blobs
sample_num = 100
fignum = 1
# we create 40 separable points
X, Y = make_blobs(n_samples=sample_num, centers=2, n_features=2, random_state=1)
# fit the model
clf = svm.SVC(kernel='line... | true |
1fccf680088eb90ee7e63f1ab4f7f1a9fbaf0ded | Python | Seliaste/DessineMaRueNSI | /fenetre.py | UTF-8 | 1,040 | 3.984375 | 4 | [] | no_license | from couleur_aleatoire import couleur_aleatoire
import turtle
def fenetre(x,y):
'''
Paramètres :
x est l'abcisse du centre de la fenêtre
y est l'ordonnée du sol du niveau de la fenetre
Remarque:
dessine une fenetre de 30 pixels sur 30 pixels
'''
turtle.colormode(255)
co... | true |
ae88d2309f08dc2b9915fe068d011102d00a6c47 | Python | nandakishor123/NLTK | /stopwords.py | UTF-8 | 538 | 3.078125 | 3 | [] | no_license | from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
example_sentence = "This is an example to show off stop word filteration."
stop_words = set(stopwords.words("english")) #make a set of all the stop words
words = word_tokenize(example_sentence)
filtered_sentence = [] #declaring empty array for... | true |
c9372a10f1a7dcc5aefc7ac35246ed0380ead054 | Python | aymannc/LeetCode | /remove-vowels-from-a-string.py | UTF-8 | 277 | 3.28125 | 3 | [] | no_license | import re
class Solution:
@staticmethod
def clean(string: str) -> str:
vow = 'A, E, I, O, U,Y'.replace(',', '|')
match = F"{vow.lower()}|{vow}"
print(match)
return re.sub(F'[{match}]', '', string)
print(Solution.clean("aemiOytrer"))
| true |
00c97b54e3fd681f0b9f484a05904f52b283eb74 | Python | Sprivideo4/Samsung-Prism-Project | /labels/test_csv_gen.py | UTF-8 | 471 | 2.703125 | 3 | [] | no_license | import os
import csv
dir_path = "/content/drive/My Drive/dataset/test/"
class_name = os.listdir(dir_path)
data = []
for cls in class_name:
videos = os.listdir(dir_path+cls)
for video in videos:
name,ext = video.split('.')
data.append((name, "test"))
data.sort()
with open('/content/drive/My Drive/samsung/labels/... | true |
2c3b68c9d28ab47e2b4b0ca097b71e229f0a6de6 | Python | chrismerck/ditditlog | /ditditlog.py | UTF-8 | 3,960 | 2.96875 | 3 | [] | no_license | import time
import sys
import json
import os
class DDDatabase(object):
def __init__(self, db_fn):
self._db_fn = db_fn
self.revert()
self._print_keys = [
'call',
'year', 'month', 'day',
'utc',
'band', 'mode',
'r... | true |
b53def680507f151a4e0bfcdf3d5e1260e26621f | Python | jmlapicola/Python_Puzzles | /Long_Division.py | UTF-8 | 484 | 3.453125 | 3 | [] | no_license | def cycle_length(num):
place = 0
remainder = 1
history = list()
while remainder not in history:
history.append(remainder)
remainder = remainder % num
if remainder == 0:
return 0
remainder *= 10
place += 1
return place - history.index(remainder)
ma... | true |
9e0d2ee387295f1b44177ad2794d73ab19e53ed5 | Python | bar2104y/Abramyan_1000_tasks | /Results/Python/Array/113.py | UTF-8 | 265 | 2.9375 | 3 | [] | no_license | from genarr import genRandomArr
n = int(input("N: "))
a = genRandomArr(n)
print(a)
for i in range(n):
ma = 0
mai = 0
for j in range(n-i):
if a[j] > ma:
ma = a[j]
mai = j
a[n-i-1],a[mai] = a[mai], a[n-1-i]
print(a)
| true |
46cebd7ba09862014e1111657460e52f3b86b9f2 | Python | agvaibhav/Hashing | /lucky_number.py | UTF-8 | 1,094 | 3.390625 | 3 | [] | no_license |
def subsequences(inp, out, i, j):
# base case
if i==len(inp):
subsequence.append(''.join(out))
return
# rec case
# include current char
out[j] = inp[i]
subsequences(inp, out, i+1, j+1)
# exclude current char
out[j]=''
subsequences(inp, out, i+1, j)
... | true |
3a90a329e6ee1df26d935996b7051e52017415cb | Python | practicode-org/backend | /practicode_backend/workers.py | UTF-8 | 5,528 | 2.6875 | 3 | [] | no_license | import asyncio
import ujson as json
import random
from typing import List, Dict
class Worker:
def __init__(self, worker_id: str, build_env: str):
self.worker_id = worker_id
self.build_env = build_env
self.busy_factor = 0
def inc_busy_factor(self):
self.busy_factor += 1
de... | true |
ce345bf13514950de1c4d92102eb962fe707b009 | Python | randybeard/mavsim_template_files | /mavsim_python/chap3/mav_dynamics.py | UTF-8 | 4,119 | 3.015625 | 3 | [
"MIT"
] | permissive | """
mav_dynamics
- this file implements the dynamic equations of motion for MAV
- use unit quaternion for the attitude state
part of mavsimPy
- Beard & McLain, PUP, 2012
- Update history:
12/17/2018 - RWB
1/14/2019 - RWB
"""
import sys
sys.path.append('..')
import numpy as np
# l... | true |
8ecbd4e4d76867b069bff1028583ef0a20a0ed54 | Python | carlosborgesreis/python-aiohttp-server-example | /services/criptografa_senha.py | UTF-8 | 158 | 2.8125 | 3 | [] | no_license | import hashlib
def hash_sha256(pwd):
return hashlib.sha256(pwd.encode()).hexdigest()
def hash_md5(pwd):
return hashlib.md5(pwd.encode()).hexdigest() | true |
3f57f347f924483083ffc575096cfea5bdd8d10c | Python | Jackie-Tran/LCS-Fantasy-League | /scraper/playerscraper.py | UTF-8 | 2,310 | 3.15625 | 3 | [] | no_license | import requests, re, json
from bs4 import BeautifulSoup
class ProPlayer:
def __init__(self, firstName, lastName, otherName, nationality, ign, role, team):
super().__init__()
self.firstName = firstName
self.lastName = lastName
self.otherName = otherName
self.national... | true |
9dfe51527ba6f8b3b08d1e097d993acbed4f0c9c | Python | joshtemple/lkml | /tests/test_github.py | UTF-8 | 1,407 | 3.125 | 3 | [
"MIT"
] | permissive | """Tests open-source LookML files from GitHub to catch edge cases.
Tests in this file depend on the presence of .lkml files downloaded to the /github
directory. To download these files freshly, you'll need a GitHub API token. Then, run
the script in /scripts to download the latest batch of public LookML from GitHub.
... | true |
9bb843ef70a895d700911c9e0bddb50f661e8af4 | Python | laxur1312/py4e | /ex_07_01.py | UTF-8 | 244 | 3.375 | 3 | [] | no_license | print('python shout.py')
fname=input('Enter a file name: ')
try:
fhandle=open(fname)
except:
print('Archivo no encontrado')
exit()
for line in fhandle:
rline=line.rstrip()
rline=rline.upper()
print(rline)
| true |
f1eec6a01bbf41335d6a9b6d9f2467bd5c542d57 | Python | anujmalkotia/PES-Python-Assignment-SET-1 | /P18.py | UTF-8 | 788 | 5.03125 | 5 | [] | no_license | '''Using loop structures print numbers from 1 to 100. and using the same loop print numbers from 100 to 1 (reverse printing)
a) By using For loop
b) By using while loop
c) Let mystring ="Hello world"
print each character of mystring in to separate line using appropriate loop structure.
'''
list1=[]
for i in range(1,1... | true |
6013a880a72a0be7b3fb5b62c017bbe14921ab50 | Python | emartinezgar/utils | /generate_new_trans.py | UTF-8 | 29,550 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#########################################################################
# IDENTIFICA_SRC_TGT DESCRIPTION #
#########################################################################
#AUTHOR: Eva Martinez Garcia (emartinez at lsi.upc.edu)
#FUNCTIONALITY:Scr... | true |
8c4502e469792a92d5c0ca29198950e39de06ae9 | Python | shaqer1/conky-rc | /weather/weatherDarkSky.py | UTF-8 | 7,762 | 2.5625 | 3 | [] | no_license | import requests
import json
import datetime
import math
from shutil import copyfile
import textwrap
def windDegreeSwitcher(argument):
if(argument >= 340):
return "East"
elif(argument >= 290):
return "South East"
elif(argument >= 250):
return "South"
elif(argument >= 200):
... | true |
9cffd0758fabb317879b411b6984c6cc7c4554ba | Python | Swiftal13/Tkinter-Projects | /password_tkin.py | UTF-8 | 3,888 | 3.453125 | 3 | [] | no_license | #password generator
#imports
from tkinter import *
from datetime import date
import tkinter.font as font
import tkinter.messagebox as box
import string
import random
import time
root = Tk()
date = date.today()
root.title(f"Password generator! {date}")
root.g... | true |
3a2b4f345073abc1d4b8203f26d09056919f9a4e | Python | franAlba98/Python-Practices | /list.py | UTF-8 | 375 | 3.828125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
myfirstlist= [3, 5 , True, 12.6, 'hi']
# In[2]:
type(myfirstlist)
# In[3]:
secondlist=[5,'bye',myfirstlist]
# In[4]:
secondlist
# ---
# In[6]:
range(15)
# In[7]:
list(range(15))
# In[8]:
list(range(1,8))
# In[9]:
list(range(1,20,2)) #El terc... | true |
d3ed8e0cc9ca3c367bee53c834e19e8cc589a06c | Python | ps-snu/21-book-study | /Week04/yuvin/TRIPATHCNT/main.py | UTF-8 | 574 | 2.59375 | 3 | [] | no_license | num = int(input())
for i in range(num):
size = int(input())
res_list = list()
for i in range(size):
tri_row = list(map(int,input().rstrip().split(" ")))
if i == 0:
res_list.append((tri_row[0],1))
else:
res_list =[a if a[0]>b[0] else b if a[0]<b[0] els... | true |
999588ca30fa1d2b650ab16dd8f52c7656f45c38 | Python | laic5/clothes-matcher | /predict.py | UTF-8 | 2,935 | 2.765625 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import os
import numpy as np
import pandas as pd
from tqdm import tqdm
from PIL import Image
# In[8]:
import tensorflow as tf
import keras
from keras.applications import ResNet50
from keras.models import Model
from keras.layers import Dense, GlobalAveragePooling2D
from keras.optimizers ... | true |
a9436ac2af0ce8d12e8de7c1025c0984adc3b32e | Python | Server101/Your-Financial-Manager-Web-App | /app.py | UTF-8 | 4,538 | 2.671875 | 3 | [] | no_license | import requests
from flask import Flask, render_template, request, url_for
from flask_pymongo import PyMongo
from flask_wtf import FlaskForm
from pymongo import MongoClient
import main_functions
import os
from wtforms import StringField, DateField, SelectField, DecimalField
#pip install Flask-PyMongo Flask-WT... | true |
1a160810fa099420474743c2b7845ed374253b6f | Python | Akshay7016/Python-codes | /49 Multithreading.py | UTF-8 | 871 | 4.0625 | 4 | [] | no_license | # By default "main" thread is called
# sleep is used bcz system executes it fast so for viewing execution we use sleep()
from threading import *
from time import sleep
class Hello(Thread): # Hello is subclass of Thread
def run(self):
for i in range(5):
print("Hello")
... | true |
2077f2cb7227e36f18ca8c9d8a33ac74c4fd29ed | Python | MrPuppeteer/cs50 | /cs50x/psets/6/cash/cash.py | UTF-8 | 450 | 3.671875 | 4 | [] | no_license | from cs50 import get_float
def main():
while True:
dollars = get_float("Change owed: ")
if dollars > 0:
break
cents = round(dollars * 100)
nCoins = 0
coins = [25, 10, 5, 1]
for coin in coins:
nCoins += whileCents(cents, coin)
cents %= coin
print(f... | true |
15c934b4609dc24304f46dabef0bded33390e9c6 | Python | gombru/geoSemantics | /model_ranking_single_tag/YFCC_dataset_tags_test.py | UTF-8 | 1,047 | 2.703125 | 3 | [] | no_license | from __future__ import print_function, division
import torch
import numpy as np
import json
class YFCC_Dataset_Tags_Test():
def __init__(self):
print("Loading textual model ...")
text_model_path = '../../../datasets/YFCC100M/vocab/vocab_100k.json'
self.text_model = json.load(open(text_mod... | true |
7d24d5550560a81b6a0020fc69de197e66e4dd51 | Python | ekode/AI_sailboat | /utilsmath.py | UTF-8 | 6,545 | 3.34375 | 3 | [] | no_license | #
# Math Utils for Sailboat project
#
# Authors: Jonathan Hudgins <jhudgins8@gatech.edu>, Igor Negovetic <igorilla@gmail.com>
#
import random
from math import *
import matrix
def normalize_angle(angle):
# maps angle onto [-pi, pi]
while (angle < -pi):
angle += 2*pi
while (angle ... | true |
7c5f7709c7b7a25e8997608b1d1b1d19410f0a68 | Python | SamarthAroraa/cpp-codebase | /codecheff/APRIL CHALLENGE 2020/subsequence.py | UTF-8 | 615 | 3 | 3 | [] | no_license | def subarraySum( nums,k):
preSum = 0
k=int(k)
preSum_dict = {0:1}
res = 0
for n in nums:
preSum += n
res += preSum_dict.get(preSum-k, 0)
preSum_dict[preSum] = preSum_dict.get(preSum, 0) + 1
return int(res)
t=int(input())
k=int(0)
while(... | true |
c428f54eedc86e35eaca4a022724e46af7e6e0ee | Python | simplymanas/python-learning | /requests_example.py | UTF-8 | 321 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import requests
# download image
r = requests.get('https://imgs.xkcd.com/comics/python.png')
# with open('comic.png', 'wb')as f:
# f.write(r.content)
print(r.status_code)
print(r.headers)
print(r.ok)
print(r.url)
payload = {'page':2, 'count':25}
r = requests.get ('https:/httpbin.org/get', params =payload)
print(r... | true |
0d9a81b9852801808b3bf9034cfa27d524346bbf | Python | PlayersCouncil/LotR-TCG_CardAnalysis | /BaseCard.py | UTF-8 | 10,322 | 3.265625 | 3 | [] | no_license | import re
from collections import OrderedDict
import CardCommon
class InvalidCollectionError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
#an object that keeps track of all the attributes of a card.
# there is no effort to be efficient with the var... | true |
97c775d1e95c923e5443d4c119c28d52f848f790 | Python | DanielMGuedes/Exercicios_Python_Prof_Guanabara | /Aulas_Python/Python/Exercícios/Exe039-Alistamento Militar.py | UTF-8 | 737 | 3.71875 | 4 | [
"MIT"
] | permissive | from datetime import date
anoatual= date.today().year
anonasc=int(input('Ano de nascimento: '))
idade = anoatual - anonasc
print('Quem nasceu em {} tem {} anos em {}.'.format(anonasc, idade, anoatual))
if idade == 18:
print('Você tem que alistar IMEDIATAMENTE!')
elif idade < 18:
saldo = 18 - idade
print('Vo... | true |
ac3b0201e0b7e18a3f7dd11f14ff0121b209b3ca | Python | voidyao/mytest | /revier.py | UTF-8 | 319 | 2.734375 | 3 | [] | no_license | reviers = {
'nile': 'egypt',
'changjiang': 'jiangsu',
'huanghe': 'suzhou',
}
for revier in reviers.keys():
print("The " + revier.title() + " runs throuth " + reviers[revier].title() + ".")
for i in reviers.keys():
print(i.title())
for country in reviers.values():
print(country.title())
| true |