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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c3812e47ab0bc99a9fda9e881d6469cad96c0b01 | Python | gabrielnhn/random-implementations | /cinema.py | UTF-8 | 2,088 | 4.6875 | 5 | [] | no_license | """
The cinema problem!
We have a group of 5 people: 3 boys and 2 girls.
All of them want to sit together in the same row,
but the 2 girls must sit next to each other.
In how many different ways can we sort the row?
This implementation uses backtracking.
"""
class Person:
"""Class used to represent both boys an... | true |
ac1d5f541004e3f3bd6086aa621d9b7e8d5faf87 | Python | heldercostaa/linguagem-script-2a-lista | /samples/bouncer.py | UTF-8 | 3,011 | 3.484375 | 3 | [] | no_license | import sys, pygame, os
pygame.init()
size = width, height = 600, 400
screen = pygame.display.set_mode(size)
black = 0, 0, 0
class Bouncer(pygame.sprite.Sprite):
"""classe para o bouncer"""
def __init__(self, startpos):
pygame.sprite.Sprite.__init__(self)
self.direction = 1
... | true |
fb4df43a0145e966de7492159afeb04a363230a5 | Python | jbremer/stuffz | /mojette_z3.py | UTF-8 | 4,671 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# mojette_z3.py - Solve the grid of the day (taken from mojette.net) via z3
# Copyright (C) 2012 Axel "0vercl0k" Souchet - http://www.twitter.com/0vercl0k
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | true |
d76c9f9f26dee7a08be755e12bfe0ed4d5aeea57 | Python | DmitryBatey/Vector | /LoadFile.py | UTF-8 | 426 | 2.84375 | 3 | [] | no_license | from numpy import genfromtxt
from tkinter import filedialog as fd
class LoadFile:
# Считываем вектора из файла в список
def read_file(self):
formats = [('Comma Separated values', '*.csv'), ]
file_name = fd.askopenfilename(title="Загрузить csv-файл", filetypes=formats)
vector_list = ge... | true |
e98ff59338ed759ecf84de4ddec8023d3fa9b8ba | Python | agusbegue/realestate-scraper | /scrapy_app/utils/map_functions.py | UTF-8 | 536 | 2.875 | 3 | [] | no_license | import numpy as np
GRADE_LATITUDE = 111000
GRADE_LONGITUDE = lambda lat: GRADE_LATITUDE * np.cos(lat)
def get_map_limits(latitude, longitude, radius):
delta_lat = radius / GRADE_LATITUDE
delta_long = radius / GRADE_LONGITUDE(latitude)
northEast_lat = latitude + delta_lat
northEast_long = longitude ... | true |
9e37f6e69eb37d6829409575290fe597730f583d | Python | Incubro/Machine_learning_ST | /Class 1/classifier.py | UTF-8 | 625 | 3.078125 | 3 | [] | no_license | from sklearn import neighbors
# [height, weight, shoe_size]
X = [[181, 80, 44], [177, 70, 43], [160, 60, 38], [154, 54, 37], [166, 65, 40],
[190, 90, 47], [175, 64, 39],
[177, 70, 40], [159, 55, 37], [171, 75, 42], [181, 85, 43]]
Y = ['male', 'male', 'female', 'female', 'male', 'male', 'female', 'female',
... | true |
f4c7b5776f3192894d7843ce95e0ad880b33f809 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2560/60591/234287.py | UTF-8 | 678 | 3.1875 | 3 | [] | no_license | def cal(temp,number):
map = {}
for m in temp:
if(m in map):
map[m] = map[m] + 1
else:
map[m] = 1
temp = 1
result = len(map)
while(number>0):
for key in map.keys():
if(map[key]==temp):
number = number - temp
r... | true |
18b849247382a819d7945459761c75db1112cff8 | Python | TPiechocki/PyPO | /src/Organisms/animal.py | UTF-8 | 1,874 | 3.34375 | 3 | [] | no_license | # Copyright (c) 2019. Created by Tomasz Piechocki
from Organisms.organism import Organism
from World.Field.field import Field
from World.Directions.direction import Direction
from World.Directions.squareDirection import SquareDirection
class Animal(Organism):
def __init__(self, x, y, wrld):
super().__in... | true |
5d62be18c17dfa60f90d8841efe6c3558743ed68 | Python | HoltSpalding/PacbotV1 | /RobotFirmware/pacbot_ros_pkgs/tftest/scripts/talkernotes.py | UTF-8 | 760 | 3.1875 | 3 | [] | no_license |
import rospy
from geometry_msgs.msg import Twist
from enum import Enum
class Direction(Enum):
forward = "forward"
backward = "backward"
c_rotate = "clockwise_rotate"
cc_rotate = "countclockwise_rotate"
#abstraction for twist message
def pubTwistMsg(direction = foward, linear_units = 1.0, angle = 90)
... | true |
74c5604f6958d1a8db6269c9cd78777d7defa125 | Python | alex-muci/finance-stats-musings | /basket/basket_approx.py | UTF-8 | 7,119 | 2.890625 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.stats import norm
N = norm.cdf
# noinspection PyUnresolvedReferences,SpellCheckingInspection,PyPep8Naming
def basket_approx(opt_type: str, T: float, r: float, strike: float,
fwds, sigmas, correls, weights=None,
dtype=np.float64):
"""
Basket (an... | true |
c983234b467d91aa0de1970c37d65a18c0763f9c | Python | AkhidBunayari/Plagiarism | /python/lib/keywords.py | UTF-8 | 1,754 | 2.515625 | 3 | [
"MIT"
] | permissive | import string
from docx.api import Document
from lxml import etree
def getRequest(arr):
string = ''
for word in arr:
string += word + '____'
return string.split('____')
def readDocxParagraph(name):
str = ''
document = Document(name)
for para in document.paragraphs:
str = str + para.text + u" endpara "
... | true |
a9b23bd09b7157fa15ebeca67c5573171650ae59 | Python | vyvanvo/beebot | /beebot.py | UTF-8 | 6,510 | 2.734375 | 3 | [] | no_license | import discord
from discord.ext import commands
import random
from datetime import date
import threading
import os
from dotenv import load_dotenv
load_dotenv('.env')
token = os.getenv('DISCORD_TOKEN')
client = discord.Client()
client = commands.Bot(command_prefix = 'buzz ')
client.remove_command('help')
#negative wo... | true |
21de55371a792cd082dc6a68b2f85929ea214363 | Python | gummiharaldsson/ucaccmet2j_python | /passfail_4_python.py | UTF-8 | 1,418 | 3.296875 | 3 | [] | no_license | import json
with open('precipitation.json', encoding='utf8') as file:
data = json.load(file)
# Part 2: calculating the sum of the precipitation over the whole year
station_number = 'US1WAKG0038'
# Total precipitation for whole year and per month
total_precipitation = 0
precipitation_per_month = [0]*12... | true |
3e34e3065532e31f54b47fd24f6f670903a2466b | Python | honigwald/robocup | /project.py | UTF-8 | 14,768 | 2.734375 | 3 | [] | no_license | '''
USAGE:
- type in terminal: python project.py "10.0.7.1X"
- X is the number of the naobot
- default port is 9559 for all naobot in the project
'''
import sys
import time
import math
from naoqi import ALProxy
import speech_recognition as sr
from random import uniform
from functools import reduce
from co... | true |
298600f3efc2df6f493af003c3e8450f3963bc96 | Python | DemonZhou/leetcode | /productExceptSelf.py | UTF-8 | 638 | 2.765625 | 3 | [] | no_license | class Solution(object):
def productExceptSelf(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
output = []
n = len(nums)
prev = [1] * n
next = [1] * n
prev[0] = nums[0]
for i in range(1,n):
prev[i] = prev[i-1]... | true |
88ca85eec61269d2ed3b34dace477a861a95bed4 | Python | HanyuXi/algorithm | /datastructure/sorting/mergesort.py | UTF-8 | 601 | 3.40625 | 3 | [
"Unlicense"
] | permissive |
def sort(self, values):
if len(values)>1:
m = len(values)//2
left = values[:m]
right = values[m:]
left = self.sort(left)
right = self.sort(right)
values =[]
while len(left)>0 and len(right)>0:
if left[0]<right[0]:
values.... | true |
df3b2fc1664078cfe49ce707c641cfbf948714bd | Python | SenneRosaer/microservices | /services/back_end/rating/api/rating.py | UTF-8 | 1,648 | 2.5625 | 3 | [] | no_license | from flask import Blueprint, jsonify, request, render_template
from database.models import db
from database.models import Rating, User
from sqlalchemy import exc
rating_blueprint = Blueprint('rating',__name__)
@rating_blueprint.route('/rating', methods=['POST'])
def add_entity():
post = request.get_json()
... | true |
af136102f9585e41552ec9569fa873eeed1f2a4a | Python | HackerSchool/HS_Recrutamento_Python | /André_Santos/modules/tictactoe.py | UTF-8 | 2,449 | 3.546875 | 4 | [] | no_license | from os import system
import sys
def clear():
if sys.platform.startswith("linux"):
system("clear")
else:
system("cls")
grid = [" " for _ in range(10)]
def draw():
print(f"""\n
{grid[1]} │ {grid[2]} │ {grid[3]} 1 │ 2 │ 3
───┼───┼─── ───┼───┼───
{grid[4]} │ {grid[5]}... | true |
92ca2f68d69a101888e234945b7934aaa2c1fa23 | Python | Younggil-kim/CodingTestStudy | /BOJ/동적 계획법 1/BaekJoon1932_정수 삼각형.py | UTF-8 | 597 | 2.828125 | 3 | [] | no_license | N = int(input())
result = list()
for i in range(N):
result.append(list(map(int, input().split())))
if N == 1:
print(max(result[0]))
else:
result[1][0] += result[0][0]
result[1][1] += result[0][0]
for i in range(2,N):
for j in range(len(result[i])):
if j == 0:
r... | true |
265f21ddcae1ef723fb7a9b46fa7cc8330804a1b | Python | vijay818/ML_API | /app.py | UTF-8 | 5,106 | 2.5625 | 3 | [] | no_license | import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
import pandas as pd
app = Flask(__name__)
custbehav_model = pickle.load(open('custbehav_model.pkl','rb'))
churnpred_model = pickle.load(open('churnpred_model.pkl','rb'))
tsforecast_model = pickle.load(open('ts_sales_m... | true |
d6c61dc2039c4e4867c87561725ef80fed28e77e | Python | Debasmita-01/Competitive-Programming | /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/T-Prime.py | UTF-8 | 510 | 3.09375 | 3 | [
"MIT"
] | permissive | def answer(n):
prime = [True for i in xrange(n+1)]
prime[0] = False
prime[1] = False
p = 2
while p * p <= n:
if prime[p]:
for i in xrange(p * 2, n+1, p):
prime[i] = False
p += 1
ans = []
return prime
tprime = answer(999983)
n = int(... | true |
12ad53bb731c2b616b798f5ab443c2d1a8f8551b | Python | diegoshalom/labosdf | /software/python/instrumentos/TektronixTDS1002B.py | UTF-8 | 3,637 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Osciloscopio Tektronix TDS1002B
Manual U (web): https://github.com/diegoshalom/labosdf/blob/master/manuales/TDS1000%20manual-usuario.pdf
Manual P (web): https://github.com/diegoshalom/labosdf/blob/master/manuales/TDS1000%20programming_manual.pdf
"""
import time
from matplotlib import pyplot... | true |
e634d2b991c9eb9debae145f40ea47b58161ffdd | Python | lming08/DeepModel | /lib/metric_evaluation.py | UTF-8 | 1,699 | 2.65625 | 3 | [] | no_license |
import tensorflow as tf
def my_tf_round(x, decimals = 0):
multiplier = tf.constant(10**decimals, dtype=x.dtype)
return tf.round(x * multiplier) / multiplier
def calc_auc_logloss(labels, predictions):
ck_label = tf.where(labels>=1, tf.ones_like(labels), tf.zeros_like(labels))
ctr_auc = tf.comp... | true |
b6e415433d4f3b9c2c204666256a8445237b36ca | Python | jeffacce/ksp_gnc | /python/utilities.py | UTF-8 | 690 | 2.578125 | 3 | [
"MIT"
] | permissive | import krpc
import numpy as np
# TODO: rewrite vessel flight telemetry as a cache object of streams. Call rpc to check if physics tick happened; if not, use cached results
def get_angular_velocity(vessel, space_center):
body_ref_frame = vessel.orbit.body.non_rotating_reference_frame
angvel = vessel.angular_velocity... | true |
c0d9eab9e1c5645a09454766938f5b40756291dc | Python | nehatomar12/Data-structures-and-Algorithms | /Tree/1.all_views_of_tree.py | UTF-8 | 5,154 | 3.734375 | 4 | [] | no_license | '''
Bottom view...
7 5 8 6
Level-order.....
1 2 3 5 6 7 8
Top viiew...
2 1 3 6
Left view
1 2 5 7
Right view...
1 3 6 8
Vertical view..
[2, 7] [1, 5] [3, 8] [6]
Reverse Level order...
7 8 5 6 2 3 1
'''
import queue
class Node:
def __init__(self, data):
self.data = data
self.left = None
se... | true |
4f993ac34e0d9e255fca67f6e3054bcbbf0dbcad | Python | pulkitbhasin/FifaTournamentGenerator | /main.py | UTF-8 | 3,925 | 3.484375 | 3 | [] | no_license | import random, os
from Objects import Player, Tournament
import _pickle as cPickle
def createTournament(numPlayers, teamSelectionType):
playerNames = []
players = []
for i in range(1, numPlayers + 1):
playerName = input("Enter name of player " + str(i) + " ")
playerNames.append(playerName)
... | true |
6c201085394c456f5cdac89196e2e14a51866060 | Python | joaquinOnSoft/RestaurantXCenterInMadrid | /joaquinonsoft/restaurantlocator/CentersToRestaurantDistanceCalculator.py | UTF-8 | 2,751 | 3.078125 | 3 | [] | no_license | import geopy.distance
class CentersToRestaurantDistanceCalculator:
def __init__(self, centers, restaurants):
self.centers = centers
self.restaurants = restaurants
def calculate(self):
centers_extended_info = []
for center in self.centers:
min_distance = 100000000... | true |
54764f9878903b7ab64d87afcea40bf6b1792580 | Python | mpelland05/Dutch | /Script.py | UTF-8 | 6,151 | 3.34375 | 3 | [] | no_license | #This script will open an excel file containing words in a language and their
#translate and ask for the user to input the translations. The script will
#then update the
#
#HOWEVER,before doing so, it will ask what wants to be tested
# verbs, nouns, others, and all.
#
#The files should have columns containing th... | true |
2d1f20b3a999017189bc5019ecde1a1afe5591df | Python | valleyceo/code_journal | /1. Problems/e. Linked List/a. Manipulate - Remove Nth Node from End.py | UTF-8 | 891 | 3.828125 | 4 | [] | no_license | # 19. Remove Nth Node From End of List
'''
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Example 1:
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
Example 2:
Input: head = [1], n = 1
Output: []
Example 3:
Input: head = [1,2], n = 1
Output: [1]
'''
# Defini... | true |
cd00c8e3c362eeed3228a27ffbbd295d20f1806f | Python | FreezeKewl/Python_Class | /volume_sphere.py | UTF-8 | 3,139 | 4.25 | 4 | [] | no_license | from __future__ import division
import datetime
import math
import time
# The volume of the sphere is : V = 4/3 × π × r3 = π × d3/6.
# Thevolume of a sphere with radius r is (4/3)pir3
print("What is the volume of a sphere with radius of 5?")
def volume_of_sphere():
#pi = float(3.14)
#radius = 5
volume = (... | true |
5c6dee81c3ee87841f012aa7c0345a327cab781d | Python | adibhattar95/flask_summarizer | /bin/summarizer.py | UTF-8 | 3,831 | 3.640625 | 4 | [] | no_license | import yaml
import numpy as np
from preprocessor import PreprocessText
class FindSummary:
'''
Summarize news articles fed form file
'''
def __init__(self, config_path):
'''
Provvide path of file to summarize
Parameters
----------
text : path ... | true |
d6bc17c4ed8c667ffbad1110e5370119f9568669 | Python | oscarknagg/wurm | /tests/test_simple_gridworld.py | UTF-8 | 2,198 | 2.65625 | 3 | [] | no_license | import unittest
import torch
from wurm.envs import SimpleGridworld
from wurm.utils import head
from config import FOOD_CHANNEL, HEAD_CHANNEL, DEFAULT_DEVICE
size = 7
class TestSimpleGridworld(unittest.TestCase):
def test_basic_movement(self):
env = SimpleGridworld(num_envs=1, size=size, start_location=... | true |
f1951ecedf887959869fea5144b14eef9b015e1f | Python | greeshmagopinath/GiftCard | /bonus.py | UTF-8 | 1,934 | 3.625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
import argparse
import utility
def bonus(arr, target):
'''
prints 3 items whose prices sum up to target
todo:
* modularize find_price and bonus.py
:param arr: an array containing tuples(item,value)
:param target: integer
:return:
'''
if len(arr) < 3... | true |
6452058f82814da9a7c583dff37c5bd7f7f67181 | Python | flatplanet/Intro-To-TKinter-Youtube-Course | /sizegrip.py | UTF-8 | 956 | 3.109375 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
root = Tk()
root.title('Codemy.com - Resize The App With Sizegrip')
root.iconbitmap('c:/gui/codemy.ico')
root.geometry("400x300")
# Make the app resizable
root.resizable(True, True) # Width, Height
my_frame2 = Frame(root, highlightbackground="gray", highlightthickness=1)
... | true |
022f07cc9a9d84ed2cafa5afc521d0305ec62e90 | Python | yunmengyanjin/website | /eggs/django_lfs-0.10.2-py2.7.egg/lfs/shipping/utils.py | UTF-8 | 7,716 | 2.578125 | 3 | [] | no_license | # python imports
from datetime import datetime
# django imports
from django.conf import settings
from django.core.cache import cache
# lfs imports
import lfs.core.utils
from lfs.catalog.models import DeliveryTime
from lfs.catalog.settings import DELIVERY_TIME_UNIT_DAYS
from lfs.catalog.settings import PRODUCT_WITH_VA... | true |
c744991cc5aca71414acbc5d7c64eb3e54cf07c7 | Python | LuckingDi/alien_invasion | /Test/xingxing/xx.py | UTF-8 | 907 | 3.328125 | 3 | [] | no_license | import pygame
from pygame.sprite import Sprite
class Settings(Sprite):
'''设置类'''
def __init__(self, screen):
super().__init__()
self.screen = screen
# 导入图片
self.image = pygame.image.load("../../images/xx.bmp")
self.rect = self.image.get_rect()
self.screen_wigh... | true |
a22e15570aef88449b98c3da9b2ef47aad1c2fb5 | Python | june0313/programmers-python | /level2/소수찾기/number_of_prime.py | UTF-8 | 338 | 3.671875 | 4 | [] | no_license | def numberOfPrime(n):
# 1부터 n사이의 소수는 몇 개인가요?
return len(list(filter(isPrime, range(1, n + 1))))
def isPrime(n):
return list(filter(lambda i: n % i is 0, range(1, n + 1))) == [1, n]
# 아래는 테스트로 출력해 보기 위한 코드입니다.
print(numberOfPrime(10))
print(numberOfPrime(5))
| true |
040e2778117019840a0b08af4aef08a15b7ec5f6 | Python | luckypur/Simple-ATM-design | /person.py | UTF-8 | 746 | 3.140625 | 3 | [] | no_license | from settings import TRANSACTION_CHARGE
class Person(object):
"""
Class to represent a Consumer
this class will use atm object to interact with ATM
"""
def __init__(self, account_balance):
self.account_balance = account_balance
def dispense(self, amount, atm):
"""
di... | true |
59b9b47e33784c8389d12c60b4dc09190c3fcd83 | Python | javaxiaomangren/exam_for_python | /spider.py | UTF-8 | 2,929 | 2.8125 | 3 | [] | no_license | #/usr/bin/env python
#coding:utf8
import urllib2
from threading import Thread
from Queue import Queue
from bs4 import BeautifulSoup as bs
from bs4 import Tag
url_template = "http://www.qiushibaike.com/hot/page/%s"
thread_num = 5
task_queue = Queue()
img_queue = Queue()
def get_response(url):
return urllib2.urlo... | true |
b5dd83c5a691449b70bb52cd76d619ffe085ba7a | Python | CalmSingularity/MTUCI_SW_dev_tech | /solve_quadratic_equation.py | UTF-8 | 1,281 | 3.828125 | 4 | [] | no_license | import math
import cmath
from sys import argv
def solveQuadraticEquation (a, b, c):
print ("Quadratic equation: {0}*x^2 + {1}*x + {2} = 0".format(a, b, c))
if (a == b == 0):
if (c != 0):
print ("{0} = 0 is not a valid equation".format(c))
else:
print ("0 = 0 is not an interesting equation")
return
if ... | true |
6dc4744f71fed0fac808bbd608ffeb138d53b5b0 | Python | Amritanshu786/Python | /alphabet_pattern.py | UTF-8 | 150 | 3.234375 | 3 | [] | no_license | count = 1
for i in range(1,7):
A=65
for j in range(0,count):
print(chr(A),end='')
A = A + 1
print()
count = count + 1
| true |
97590a170ed40fbda7f4a920ce72600a8eeb4421 | Python | siddhartha-12/Infra-Assignment-4 | /codeFile.py | UTF-8 | 147 | 2.875 | 3 | [] | no_license | import datetime
if __name__ == "__main__":
now = datetime.datetime.now()
print ("Current time : ")
print (now.strftime("%H:%M:%S"))
| true |
1936e012bf8fe1c19e35a942765389e736408ce8 | Python | wesinalves/neuralnet | /neural_net.py | UTF-8 | 2,935 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | '''
High level neural net implemantations
Neural Net is a tool bio inspired in brain work. Neural nets is composed by neurons in layers, weights to connect inputs signal to neurons, and outputs.
Like dendrites, neural net has weights values struture that receiveis the input signal from external world.
Like Axion, ... | true |
b9dec42e5940b8c35dd11183db3d9824c72c4c38 | Python | AJFatale/Python-Practice | /ex_1.3.py | UTF-8 | 219 | 3.4375 | 3 | [] | no_license | fname = input("Enter file name: ")
fh = open(fname)
lst = list()
for line in fh:
l = line.split()
for w in range(len(l)):
if l[w] not in lst:
lst.append(l[w])
lst.sort()
print(lst)
| true |
33b7aa6e02f5233045f97efd60e628f2bacb2f10 | Python | Bakushin10/programming-practice | /TextJustification.py | UTF-8 | 2,832 | 3.90625 | 4 | [] | no_license | """
https://leetcode.com/problems/text-justification/
"""
class Solution:
def fullJustify(self, words, maxWidth):
"""
:type words: List[str]
:type maxWidth: int
:rtype: List[str]
"""
current = []
c = []# keep track of count
chunk = []
count = 0... | true |
b8440f9f8dab4930db99539f8c38361ef362d025 | Python | TalkyTeam/TalkyTalky | /talkytalky/test/unit/test_asr_json.py | UTF-8 | 1,327 | 2.875 | 3 | [] | no_license | from talkytalky.stt import asr_json
from talkytalky.util.util import get_project_root
def test_parse():
project_root = get_project_root()
print(project_root)
infile = open(project_root + "/talkytalky/test/transcriptions/peter_rabbit.json")
transcript = asr_json.load(infile)
assert len(transcript.... | true |
8897d8a31b925ed1afb6751d0edeb272b129607e | Python | himansh1314/GANs-Keras | /models/dcgan.py | UTF-8 | 3,504 | 2.671875 | 3 | [] | no_license | from __future__ import print_function
from utils.utils import z_noise, make_trainable
from utils.visualization import plot_results_GAN
from keras.models import Model, Sequential
from keras.layers import *
from keras.optimizers import Adam
from models.gan import GAN
from tqdm import tqdm
import numpy as np
class DCGAN... | true |
d9df1dff6a079c6a2bf16a8ab7bbe9e817cb9e8f | Python | rahul765/Simple-Deep-Dream | /deep_dream.py | UTF-8 | 4,650 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from tensorflow.keras.applications import InceptionV3
from tensorflow.keras.applications.inception_v3 import preprocess_input
from PIL import Image
from argparse import ArgumentParser
import imutils
import tensorflow as tf
import numpy as np
import cv2
def loadImage(imagePath, width = 350):
... | true |
63fd1e7d2db92b8d176ea3448455a35cf54b9ea2 | Python | ASConroy/PyXPD | /pyXPD/instrumentapi/utils/Gas_Valve.py | UTF-8 | 4,487 | 2.859375 | 3 | [] | no_license | """
Copyright (c) 2014 Brookhaven National Laboratory All rights reserved.
Use is subject to license terms and conditions.
@author: Christopher J. Wright
This module handles the gas switching valve and the flowmeters effectively aliasing the switching valve positions and \
flowmeters to the gases connected.
.. warni... | true |
ddb8da7411b15c1d5b722fb171422b833b08cf38 | Python | CarlosVV/PythonGroup_07 | /clase02/quijote2.py | UTF-8 | 450 | 3.421875 | 3 | [] | no_license | archivo = open('quijote.txt')
texto = archivo.read()
archivo.close()
# {'a': 1, 'b': 2, ....}
letras = {}
texto = texto.lower()
for letra in texto:
if letra in 'abcdefghijklmnñopqrstuvwxyzáéíóúABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ':
if letra not in letras:
letras[letra] = 1
else:
... | true |
07a2b2b913e804a380c030029eb9480f3fc24102 | Python | dsaucez/mininet_testing | /orchestrator.py | UTF-8 | 1,566 | 2.53125 | 3 | [] | no_license | import network_parser, flow_manager, mininet_manager, solution_parser
class Orchestrator(object):
def __init__(self, network_file_path, request_file_path, solution_file_path):
self.network_parser = self.__create_network_parser(network_file_path)
self.request_parser = self.__create_request_parser(r... | true |
f12a3f158c2b701d5d1007cd76343e9e0d3d2aec | Python | theNicelander/advent-of-code-2020 | /day04/day04.py | UTF-8 | 1,777 | 3.265625 | 3 | [] | no_license | import pandas as pd
from utils.files import read_groups_into_list
class Passport:
def __init__(self, path):
self.passport_strings = read_groups_into_list(path)
self.passport_dicts = self._strings_to_dicts()
def _strings_to_dicts(self):
passports = [passport.split(" ") for passport in ... | true |
45403ce88c24730eddd7d7fa32b729ef6449da72 | Python | coolzc/download-file-from-github | /jisuanlilun_pachong.py | UTF-8 | 1,010 | 2.515625 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
import requests
import urllib
from bs4 import BeautifulSoup
if __name__ == '__main__':
def download(url, file_name):
with open(file_name, "wb") as file:
response = requests.get(url)
file.write(response.content)
#target = ''
target = 'https://github.c... | true |
0ae6b5da0f3523596e8a67a72efca832ed68ab39 | Python | hunnam5220/coding_test_study | /[나동빈]이것이 코딩 테스트다/09. Solutions/06. Sixth/02. 구현/14._*_외벽 점검.py | UTF-8 | 853 | 3.171875 | 3 | [] | no_license | from itertools import permutations
def solution(n, weak, dist):
weak_length = len(weak)
answer = len(dist) + 1
for i in range(weak_length):
weak.append(weak[i] + n)
weak.sort()
for start in range(weak_length):
for friends in list(permutations(dist, len(dist))):
count... | true |
2a96a4fc7ef892a835524aa92d97ed6eae11bee5 | Python | dbradul/python_course | /utils.py | UTF-8 | 276 | 3.078125 | 3 | [] | no_license |
def parse_length(request, default=10):
value = request.args.get('length', str(default))
if not value.isnumeric():
raise ValueError('Not a number')
value = int(value)
if not 3 < value < 100:
raise ValueError('Out of range')
return value
| true |
56503086215d8a4d3701bbab841df595fd05c1b9 | Python | Young-Jo-Choi/data_analysis | /OOP/16_type_alias.py | UTF-8 | 1,246 | 3.375 | 3 | [] | no_license | from typing import Union, List, Tuple, Optional, Dict
from typing_extensions import TypedDict
# type alias
value: Union[
int, bool, Union[List[str], List[str], Tuple[int, ...]], Optional[Dict[str, float]]
] = 17
# 가독성과 재사용성이 너무 떨어진다.
def cal(
v: Union[
int,
bool,
Union[List[str], List[... | true |
af9d4a4b573e895b1f10fc3c03a558fdeabb59c7 | Python | aaiyeolaa/car | /car.py | UTF-8 | 1,077 | 3.25 | 3 | [] | no_license | class Car:
def __init__(self, make, model, year):
self.make = make
self.model = model
self.year = year
self.mileage_reading = 0
def json(self):
return {
'make': self.make,
'model': self.model,
'year': self.year
}
def get_c... | true |
dd16251fa51a151a61fd2c0ef9830cb81a1d3e7d | Python | Laikiru/Dice-Roller-P | /Dice Roller.py | UTF-8 | 557 | 3.9375 | 4 | [] | no_license | print('Enter dice number you would like to roll. (6, 8, 20, etc.)')
roll = int(input()) #d10, d20, d2, etc.
print('d ', roll)
while roll <= 1:
print('Error. Please enter a number higher than 1.')
break
import random #randomizes roll from 1 to x
min = 1
max = roll
print('Enter character modifier.'... | true |
fc330010ece750c951fa567fcf8bf8c1291f1428 | Python | qdev-dk/QDataLib | /qdatalib/tolib.py | UTF-8 | 9,502 | 2.609375 | 3 | [
"MIT"
] | permissive | import os
import glob
import re
import pprint
import qcodes as qc
import pandas as pd
from typing import Tuple, Optional, Dict, Union, List, Any
from pymongo import collection
import xarray as xr
from qcodes.dataset.sqlite.database import connect
from qcodes.dataset.database_extract_runs import extract_runs_into_db
fr... | true |
4f344a23fc6a5efbe1a704eed55c5518e229e1ee | Python | Mstfkmlbsbdk/Class5-Python-Module-Week3 | /Week03_Hw_3.py | UTF-8 | 117 | 2.84375 | 3 | [] | no_license | def abccc():
items=[i for i in input().split('-')]
items.sort()
#print('-'.join(abccc))
print(abccc)
| true |
137eb17d458846690aa5bbde208f79d0eaaaafba | Python | alineberry/alcore | /alcore/pytorch/models/base.py | UTF-8 | 5,043 | 3.109375 | 3 | [] | no_license | import torch
import torch.nn.functional as F
from torch import nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
class FCLayer(nn.Module):
"""Standard base level fully-connected layer. Has the option to chain together batch norm, dropout, linear,
and activation function (in that orde... | true |
28cbeebd2e87cc1ce457f93b490a3c3de5a0b3a2 | Python | gstephan30/FuPlanter | /wunderground.py | UTF-8 | 1,716 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
import Adafruit_DHT
import Adafruit_BMP.BMP085 as BMP085
from datetime import datetime
import requests
sensor1 = Adafruit_DHT.DHT22
pin = 18
humidity, temperature = Adafruit_DHT.read_retry(sensor1, pin)
DewPoint = ((humidity / 100) ** 0.125) * (112 + 0.9 * temperature) + (0.1 * temperature) - 112
Dew... | true |
a7bfd640fb953594796c97e80687c5a6521dcc7a | Python | rawide/mypython | /dl/llama/macs.py | UTF-8 | 2,013 | 2.75 | 3 | [] | no_license | import sys
import math
print(sys.argv, len(sys.argv))
if len(sys.argv) != 9:
print("please input the model parameters, ./macs.py [words size] [hidden_dims] [decoder layers] [heads] [ffn hiden nodes] [in_lens] [out_lens] [max_len] \n")
exit()
word_size = int(sys.argv[1])
word_dims = int(sys.argv[2])
decoder_la... | true |
95df9143c476a1094f724a1a86cbbe2f2a2fde84 | Python | stevelittlefish/littlefish | /littlefish/encoder.py | UTF-8 | 1,341 | 3.6875 | 4 | [
"Apache-2.0"
] | permissive | """
Shamelessly stolen from stack overflow. Maps integer values onto
strings of characters - useful for generating things like voucher codes
"""
import logging
__author__ = 'Stephen Brown (Little Fish Solutions LTD)'
log = logging.getLogger(__name__)
class Encoder:
def __init__(self, alphabet):
"""
... | true |
73de589811d0d20c814117f44f7c1dfc26f0770b | Python | andrewjli/MakeItHappen | /utils.py | UTF-8 | 2,670 | 2.609375 | 3 | [] | no_license | #import bcrypt
#from hackkings.constants import BCRYPT_WORK_FACTOR
from werkzeug.security import generate_password_hash, check_password_hash
from urllib2 import urlopen, Request
from bs4 import BeautifulSoup
from datetime import datetime
from Queue import Queue
from threading import Thread, Lock
CodeAcademyQueue = Qu... | true |
36585a3ceb48a598597bcf2956234450e5d0764c | Python | mephis5150/Flask_FirstApp | /backend/database.py | UTF-8 | 277 | 2.625 | 3 | [] | no_license | import pymysql
def connection():
try:
connect = pymysql.connect('127.0.0.1', 'root', '', 'loginoop')
if connect:
print("Database is connected.")
return connect
except Exception as e:
return "Something was wrong! : " + str(e) | true |
b5dc5f529205d3a91f91233e0a96c2c073ed4906 | Python | rodolfojbrandao/gitrepository | /ex82.py | UTF-8 | 305 | 3.53125 | 4 | [] | no_license | resposta = 's'
lista = list()
pares = list()
impares = list()
while resposta == 's':
n = int(input('digite: '))
lista.append(n)
if n%2==0:
pares.append(n)
else:
impares.append(n)
resposta = str(input('quer continuar? [s/n] '))
print(lista)
print(pares)
print(impares) | true |
56512929de1d31e2a5027f02874d50ef8d5e76f5 | Python | lixiang2017/leetcode | /explore/2020/december/Decoded_String_at_Index.3.py | UTF-8 | 806 | 2.84375 | 3 | [] | no_license | '''
You are here!
Your runtime beats 79.55 % of python submissions.
'''
class Solution(object):
def decodeAtIndex(self, S, K):
"""
:type S: str
:type K: int
:rtype: str
"""
size = 0
length = len(S)
pos = 0
for pos in range(length):
... | true |
f9ad1ef5d30a934808a86b2b11c38309dd41c991 | Python | surendranaidu/nrpe-plugins | /url_test.py | UTF-8 | 4,910 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
#
# Nagios custom NRPE plugin to monitor a website at regular intervals using
# python requests library
#
import requests
import sys
import time
from optparse import OptionParser
from requests.exceptions import HTTPError
# Nagios exit status values
ST_OK = 0
ST_WR = 1
ST_CR = 2
ST_UK = 3
# Globa... | true |
d582e1273d484235a922de72ef886887e3b27ac7 | Python | wustep/jifter | /crawler/clean_products.py | UTF-8 | 458 | 2.609375 | 3 | [] | no_license | import json
from classes import Product
from constants import PRODUCT_PATH
if __name__ == "__main__":
for product_fname in PRODUCT_PATH.iterdir():
fpath = PRODUCT_PATH.joinpath(product_fname)
print("Cleaning {}".format(fpath))
with open(fpath) as f:
data = json.load(f)
... | true |
819b5984db35b8a06382813cc21a7583766742aa | Python | CodeChenL/PyQtCANLINTools | /usb2can.py | UTF-8 | 8,320 | 2.71875 | 3 | [] | no_license | """
文件说明:USB2XXX CAN操作相关函数集合
更多帮助:www.usbxyz.com
"""
from ctypes import *
import platform
from usb_device import *
# 1.CAN信息帧的数据类型定义
class CAN_MSG(Structure):
_fields_ = [
("ID",c_uint), # 报文ID。
("TimeStamp",c_uint), # 接收到信息帧时的时间标识,从CAN 控制器初始化开始计时。
("RemoteFlag",c_ubyte),... | true |
2fea632cd02a2ed9d4cd90dd5d06de81b1f7fe15 | Python | daaditya5/classes | /class_example.py | UTF-8 | 1,350 | 3.59375 | 4 | [] | no_license | # instance.method(arguments) is automatically converted into class.method(instance, arguments)
class Person:
def __init__(self, name, job=None, pay=0):
self.name = name
self.job = job
self.pay = pay
def lastname(self):
return self.name.split()[-1]
def giveRaise(self, per... | true |
37d08372fc039a832d826dcf0576c0f7c267b521 | Python | daniel-reich/ubiquitous-fiesta | /MTGTSJvAi2iwd2Ygs_16.py | UTF-8 | 167 | 2.75 | 3 | [] | no_license |
def valid_division(d):
ss = d.split('/')
if int(ss[1]) == 0:
return 'invalid'
elif (int(ss[0]) % int(ss[1]))== 0:
return True
else:
return False
| true |
88fdd1219781194d8d8093346cbecfe81fce7e40 | Python | BeomgiJung1/09jungb | /hangmanNov20.py | UTF-8 | 7,382 | 3.140625 | 3 | [] | no_license | import random
import turtle
import time
wordList = ['advocate', 'austere', 'benevolent', 'clout', 'complacent', 'deficient', 'eminent', 'facilitate',
'galvanizing', 'incite', 'novel', 'oust', 'retention', 'prohibit', 'undermine', 'tentative', 'vital',
'fiscal', 'evoke', 'disparage']
secretWord... | true |
bbf15d9a8b14d60b6a33b6b00ada967050f33cca | Python | ashwinreddy/utils | /utils/matrix.py | UTF-8 | 139 | 2.734375 | 3 | [] | no_license | import numpy as np
def cartesian_product(x, y):
return np.transpose([
np.tile(x, len(y)),
np.repeat(y, len(x))
])
| true |
deddda958c7c07923baf583a811bd37a99ad248a | Python | mquevill/fomms_integrate | /fomms_integrate/stochastic.py | UTF-8 | 1,152 | 3.453125 | 3 | [
"BSD-3-Clause"
] | permissive | """
This function implements 1d Monte Carlo integration
"""
import numpy as np
def monte_1d(x, f, trials):
"""
Compute a 1D definite integral
Parameters
----------
f : function
User defined function.
x : numpy array
Integration domain.
trials : integer
Total number ... | true |
7b7ec7c784f0d11e9768133d80bd0130321fdda2 | Python | SumitNalavade/apstylecheck | /apstylecheck.py | UTF-8 | 3,963 | 3.328125 | 3 | [
"MIT"
] | permissive | from word2number import w2n
from num2words import num2words
import word2number
def validate_wordisnum(text):
try:
w2n.word_to_num(text)
except ValueError:
return False
else:
if(text.isnumeric() == True):
return False
else:
return True
... | true |
e5f0e4d8e7de512d4473af3b42154fa0941734bb | Python | brunoleej/study_git | /ML,DL, RL/Reinforcement Learning/RL Env/Gym Basic/Classic Control/CartPole/Cartpole_v1.py | UTF-8 | 2,718 | 2.96875 | 3 | [] | no_license | import gym
env = gym.make('CartPole-v1')
print("Action Space : {}, Action Space Shape : {}".format(env.action_space, env.action_space.shape)) # Discrete(2) ()
print("Observation Space : {}, Observation Space Shape : {}".format(env.observation_space, env.observation_space.shape)) # Observation Space : Box(-3.4... | true |
a0291a0f096ea0e8830e3d490afe83336a343c8c | Python | pjdg/TFG-Opt.-Bayesiana | /Simulación OptBayesiana.py | UTF-8 | 22,180 | 2.703125 | 3 | [] | no_license |
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.optimize import minimize
from scipy.stats import norm
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF, ConstantKernel, Matern
from skopt.benchmarks... | true |
bac2bcaeed74ec6c13e92d3f0f36bf0e22bebbe5 | Python | AdityaVelugula/Python | /ICP4/svm.py | UTF-8 | 955 | 3.28125 | 3 | [] | no_license | # Support Vector Machine (SVM)
# Importing the libraries
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
from sklearn import metrics
from sklearn.metrics import classification_report
# Importing th... | true |
2948bd9213e0d243d9898dfddc0f949b44f8a34e | Python | arfizurrahman/python | /Python Basics/dictionary.py | UTF-8 | 303 | 3.09375 | 3 | [] | no_license | dictionary = {
123: [1, 2, 3],
'b': 2
}
my_list = [
{
'a': [1, 2, 3],
'b': 2
},
{
'a': [4, 5, 6],
'b': 2
}
]
user = {
'name': 'Arfiz',
'age': 25
}
user2 = dict(name='Ashfaq')
print('age' in user)
print(user.get('age', 44))
print(user2)
| true |
16c10bd0dfb43ee68e5300bb16b840d86a5bf6e1 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_96/713.py | UTF-8 | 1,170 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
'''
'''
import sys
from pprint import pprint
def do_one_case(csn, N, S, p, l):
''' Not thoroughly debugged...'''
googlers = 0
for n in l:
if n // 3 > p-1:
googlers += 1
#print "adding g for:", n
if n // 3 == p-1 and n != 0:
... | true |
6c86bb28b36afb95ee97984c9131ce2af3e7a861 | Python | gallaghers18/BikeshareVis | /Bikeshare.py | UTF-8 | 5,380 | 2.890625 | 3 | [] | no_license | from flask import Flask, render_template, jsonify
import datetime
app = Flask(__name__)
with app.app_context():
print("Beginning Formatting CSVs")
def formatCsvData(csv_path):
dataIn = {}
dataOut = {}
with open(csv_path) as csvData:
next(csvData)
dayMap = ['Mon... | true |
809aba905c363f9165479408cddf940459bba1bb | Python | PyQtWorks/PyQtMeter | /src/cpuMeter.py | UTF-8 | 690 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from Meter import Meter
from PyQt4 import QtGui, QtCore
"""fun to read cpu info """
try:
import psutil
def currentCPU(time):
return psutil.cpu_percent(time)
except ImportError:
def currentCPU(time):
print "no moudle named psutil"
... | true |
7552487c6123363f4e15d787b7163978dec2aeb0 | Python | scott-vsi/networkx | /networkx/generators/tests/test_inverse_line.py | UTF-8 | 4,817 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | import networkx as nx
from nose.tools import *
import networkx.generators.inverse_line as inverse_line
from networkx.testing.utils import *
from networkx.exception import NetworkXError, NetworkXNotImplemented
class TestGeneratorInverseLine():
def test_example(self):
G = nx.Graph()
G_edges = [[1,2... | true |
5ab97cd6e10ba6e089c20246dc75d384bf26d386 | Python | zfit/zfit | /tests/test_functor_pdf.py | UTF-8 | 1,500 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright (c) 2022 zfit
import pytest
import zfit
from zfit.util.exception import NormRangeUnderdefinedError
limits1 = (-4, 3)
limits2 = (-2, 5)
limits3 = (-1, 7)
obs1 = "obs1"
obs2 = "obs2"
space1 = zfit.Space(obs=obs1, limits=limits1)
space2 = zfit.Space(obs=obs1, limits=limits2)
space3 = zfit.Space(obs=obs1, l... | true |
5c2f257c5bfd1607081482662d43acc63b7fff4a | Python | Andrushens/ISPLabs | /lab2/serializer/parsers/yaml/yaml_serialization.py | UTF-8 | 1,693 | 2.9375 | 3 | [] | no_license | def serialize_yaml(obj) -> str:
if type(obj) == tuple:
ans = "/tuple"
parsed = []
if len(obj) == 0:
return f"{ans} []"
for i in obj:
parsed.append(serialize_yaml(i).replace("\n", "\n "))
parsed.insert(0, ans)
return "\n- ".join(parsed)
els... | true |
05585716b52c1a395e563215afd4934fbef630a2 | Python | exHomunculus/minorMud | /map.py | UTF-8 | 3,775 | 3.4375 | 3 | [] | no_license | """
This module will contain the Map class. It will house all Map related functions.
It will also connect to the MudData module for set/get Room data from the dB.
Contains call to Map which should be instantiated when the Mud is loaded.
author: Bob Hinkle - hinkle.bob@gmail.com
"""
import muddata
import ansi
# Change... | true |
e7d8ab3f70687a96c4c8d3b055c1314641be6800 | Python | huangjf11/alien_invasion | /game_functions.py | UTF-8 | 882 | 3.015625 | 3 | [] | no_license | import sys
import pygame
#监视屏幕和鼠标事件
def check_events(ship):
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_RIGHT:
ship.moving_right=True
elif event.key == pygam... | true |
02b8b1c69345a2e86df9f215c2ef0ee65d7c19ee | Python | nagellack5C/voting-test-task | /server.py | UTF-8 | 3,323 | 2.5625 | 3 | [] | no_license | import json
from flask import Flask, request, make_response
from flask_httpauth import HTTPBasicAuth
from db_client import *
app = Flask(__name__)
auth = HTTPBasicAuth()
'''SERVICE FUNCTIONS'''
@auth.verify_password
def verify_credentials(username, password):
return db_verify_credentials(username, password)
... | true |
f3990823a291e466b4db60418f705ae5bbfa54e6 | Python | tuantom9798/fastapi-mongodb-backhug | /app/util/__init__.py | UTF-8 | 2,169 | 2.609375 | 3 | [
"MIT"
] | permissive | import json
from urllib.parse import parse_qs
import json
import pytz
from datetime import datetime, timezone
import dateutil.parser
def localize_tz(dt, timezone="UTC"):
loc_tz = pytz.timezone(timezone)
dt = loc_tz.localize(dt)
return dt
def parse_date(date_str, str_format="%Y-%m-%d %H:%M", timezone="UTC"... | true |
62a77218baf762954677e13a518705e41fa68237 | Python | microresearch/notes | /tiny_mining/potentiostat_mining/iorodeo_second_conditioningforHM1.py | UTF-8 | 3,183 | 3.0625 | 3 | [] | no_license | import scipy
from potentiostat import Potentiostat
import matplotlib.pyplot as plt
# Second set of pre-conditioning for ItalSens HM1 - this is the second one which is run 10 times - we do this manually at first!
print("Second set of pre-conditioning for ItalSens HM1 - this is the second one which is run 10 times - we... | true |
9e624aa173168050882363be856e798e7d533e3d | Python | shekkoirala/vrp-web-django | /vrp_core/vrp.py | UTF-8 | 8,805 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# In[1]:
import os
import json
import urllib.request
import csv
import pandas
import googlemaps
import pandas as pd
from django.conf import settings
from ortools.constraint_solver import pywrapcp
from ortools.constraint_solver import routing_enums_pb2
gmap = googlemaps.Client(key=os.getenv(... | true |
1da9920079911476e669461c29b2cc48b121f15f | Python | confettimimy/Python-for-coding-test | /구현/[2_백준] 1475번 방 번호.py | UTF-8 | 294 | 3.359375 | 3 | [] | no_license | n = input() # ex) 9998
set_num = [0 for _ in range(9)] # 0~8
for i in n:
if int(i) == 6 or int(i) == 9:
set_num[6-1] += 0.5
else:
set_num[int(i)-1] += 1
answer = max(set_num)
if answer - int(answer) == 0.5:
answer +=1
print(int(answer))
'''반례: 69696'''
| true |
e74ce81037baae7a376143a4188dc9d6806d9d71 | Python | cclaude42/python_bootcamp | /day01/ex03/generator.py | UTF-8 | 1,468 | 3.703125 | 4 | [] | no_license | #!/usr/bin/env python3
""" Vector tests
"""
def generator(text, sep=" ", option=None):
"""A generator that splits text according to 'sep' and 'option', and yields the results"""
if not isinstance(text, str) or option not in [None, "shuffle", "unique", "ordered"]:
yield "ERROR"
else:
if opti... | true |
6f428116d6b3e1f368c032b0b5d3ce7bd91958d2 | Python | Vanojx1/AdventOfCode2019 | /D17.py | UTF-8 | 7,490 | 2.796875 | 3 | [] | no_license | from intcode import IntcodeProgram
import tkinter as tk
import re
with open('input/d17.txt') as f:
d17_input = [int(l) for l in f.read().split(',')]
CROSSING = 0
WALKED = 1
SCAFFOLD = 35
TOP = 94
RIGHT = 62
BOTTOM = 118
LEFT = 60
SPACE = 46
class Tile(object):
color_map = {
CROSSING: 'blue',
... | true |
66b77946a0ffb3c6b7594c3b2a4a9ff033fe96ee | Python | Wellsjian/20180826 | /xiaojian/xiaojian/third_phase/day02/ddd.py | UTF-8 | 373 | 3.625 | 4 | [] | no_license | import turtle
def draw_size(size):
for i in range(5):
turtle.fd(size)
turtle.right(144)
def main():
turtle.penup()
turtle.back(600)
turtle.pendown()
turtle.pensize(3)
turtle.pencolor("red")
size = 50
turtle.exitonclick()
while True:
draw_size(50)
if __name__... | true |
8d95029495c7d1741c2e22bcf52b5ae73bee3faa | Python | snjumaheshwari/Codechef-Challenges | /Cypher/RECSTR.py | UTF-8 | 1,106 | 4.25 | 4 | [] | no_license | """ Scube is working on a recursion, which is same as the following function.
string f( int N ) {
if (N == 0) return "a";
if (N == 1) return "b";
if (N == 2) return "c";
return f( N - 1 ) + f( N - 2 ) + f( N - 3 );
}
But he doesn't have time to code this, so he will give you two number N and K, find the Kth ch... | true |
e896b161fe0e61c1928de781812ad7da213c1c57 | Python | SakiFu/sea-c28-students | /Students/SakiFu/session05/dict_sets_comp.py | UTF-8 | 811 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
food_prefs = {"name": u"Saki",
u"city": u"Sapporo",
u"cake": u"Redvelvet",
u"fruit": u"Mango",
u"salad": u"seaweed",
u"pasta": u"seafood"}
print u"{name} is from {city}, and she likes {cake} cake, {fruit... | true |
4d5da17fc04c074ba68413f39472389bbcd95758 | Python | shitikamiyako/Django_Project3 | /question/models.py | UTF-8 | 1,821 | 2.734375 | 3 | [] | no_license | from django.db import models
from accounts.models import CustomUser
from datetime import datetime
class Question(models.Model):
"""質問文モデル
question: str
"""
class Meta:
db_table = 'Question'
verbose_name_plural = 'アンケート質問文'
question = models.CharField('質問文', max_length=255, defaul... | true |