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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f15db92bf048ac1c0becd6b118825be852b63774 | Python | Aasthaengg/IBMdataset | /Python_codes/p03760/s958997741.py | UTF-8 | 117 | 2.765625 | 3 | [] | no_license | O=input()
E=input()
P = ""
for i in range(len(E)):
P += O[i]
P += E[i]
if len(O)-len(E)==1:
P += O[-1]
print(P) | true |
612e503009acde2eaee4df4f0d1b28db14a71338 | Python | rkdr055/BOJ | /2997.py | UTF-8 | 280 | 3.09375 | 3 | [] | no_license | a,b,c=map(int,input().split())
list1=[a,b,c]
list1=sorted(list1)
if list1[1]-list1[0] == list1[2]-list1[1]:
print(list1[2]+list1[2]-list1[1])
elif (list1[2]-list1[1])//(list1[1]-list1[0])==2:
print(list1[1]+list1[1]-list1[0])
else:
print(list1[1]-(list1[2]-list1[1]))
| true |
7f8d4793eefa9f0d8fd3499113ca788e249ce41a | Python | lyqscmy/iredis | /tests/unittests/test_utils.py | UTF-8 | 2,659 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | import re
import time
import pytest
from unittest.mock import patch
from iredis.utils import timer, _strip_quote_args, split_command_args
from iredis.commands_csv_loader import all_commands
from iredis.utils import command_syntax
from iredis.style import STYLE
from iredis.commands_csv_loader import commands_summary
fr... | true |
322632c0c7c915cc150934a19cf7bc6502125190 | Python | sachinchauhan10497/Hack_gseb | /filter.py | UTF-8 | 1,296 | 2.8125 | 3 | [] | no_license | import sys
from processes import make_url
import webbrowser
import configs
filters = []
for i in range(1,len(sys.argv)):
filters.append(sys.argv[i])
def process_file():
output = {}
f = open(configs.FILE_TO_SAVE_SEAT_NAME_PAIR)
for line in f:
values = line.split("-")
if len(values) > 1:... | true |
36ee61b891bac431f323459bd7fa6c7c8cbb5576 | Python | EnotionZ/FoodListing | /RestaurantStore.py | UTF-8 | 1,812 | 3.015625 | 3 | [] | no_license | """
UserInfo.py -- Grabs user info from the database.
by Sean.
"""
from Config import Config
from pymongo import Connection
from datetime import datetime
import time
from base64 import b64encode
from hashlib import sha256
import logging
class RestaurantStore:
def __init__( self, config ):
sel... | true |
b08ec101695ebebe2a0d205ec85ab68a49360894 | Python | hwheelen/state_senate_results | /process_2016.py | UTF-8 | 956 | 2.921875 | 3 | [] | no_license | import pandas as pd
import geopandas as gpd
import numpy as np
#input start path
start_path = ''
#load in raw election data
raw_elec = gpd.read_file(start_path + 'GitHub/MEDSL/stateoffices2016.csv')
#select states and print offices for this state in 2016
states = ['Florida']
for st in states:
st_df = raw_elec.lo... | true |
9b30f1bab9f67cbec2556916f6fae8542997b5a2 | Python | RoboticsClubatUCF/Laki2 | /catkin_ws/src/laki2_mechanical/ugv/winchCalc.py | UTF-8 | 19,478 | 2.921875 | 3 | [] | no_license | from __future__ import division
import numpy as np
from scipy import integrate
from scipy.optimize import minimize
import matplotlib.pyplot as plt
#----------------------------------------------------------------------------------#
# BE WARNED: currently does not work for spool sizes other than what is listed as a
# ... | true |
258e1c878555c9cf6d9b52e8c7001a650e0eeb8e | Python | youknowbaron/LearnPythonTheHardWay | /ex18.py | UTF-8 | 382 | 3.765625 | 4 | [] | no_license | def print_three(*args):
arg1, arg2, arg3 = args
print(f"arg1: {arg1}, arg2: {arg2}, arg3: {arg3}")
def print_two(arg1, arg2):
print(f"arg1: {arg1}, arg2: {arg2}")
def print_one(arg1):
print(f"arg1: {arg1}")
def print_none():
print("I got nothin'.")
print_three("i", "am", "baron!")
print_two("jus... | true |
246eec142e2cdb9c9c0f735df23e28f851c2e98c | Python | R4f4Lc/Programacion1Daw | /Segundo Trimestre/1- Primeros Ejercicios POO/Python/TestFraccion.py | UTF-8 | 2,312 | 4.59375 | 5 | [] | no_license | # -*- coding: utf-8 -*-
"""
Crea una clase Fraccion (en Java yPython) de forma que podamos hacer las siguientes operaciones:
Contruir un objeto Fraccion pasándole al constructor el numerador y el denominador.
Obtener la fracción.
Obtener y modificar numerador y denominador. No se puede dividir por cero.
Obtener result... | true |
d8efef2976f32b6f34472d21a735827d763f9f34 | Python | dimitymiller/cac-openset | /networks/openSetClassifier.py | UTF-8 | 5,065 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | """
Network definition for our proposed CAC open set classifier.
Dimity Miller, 2020
"""
import torch
import torchvision
import torch.nn as nn
class openSetClassifier(nn.Module):
def __init__(self, num_classes = 20, num_channels = 3, im_size = 64, init_weights = False, dropout = 0.3, **kwargs):
super(openSetC... | true |
dc44fb896ceb55a200c7967e9bcd913ca5d76275 | Python | bhyun/daily-algorithm | /2022/2022.06/Programmers_추석트래픽.py | UTF-8 | 1,194 | 3.109375 | 3 | [] | no_license | def solution(lines):
answer = 0
responses = []
for line in lines:
date, time, t = line.split()
t = float(t[:-1]) * 1000
hour, minute, second = time.split(":")
endtime = (int(hour) * 3600 + int(minute) * 60 + float(second)) * 1000
responses.append((endtime - t + 1, ... | true |
6a2442189f3934c7f79113a7b8b997d8328d22e3 | Python | kathrynzav/DukeTIP2018Projects | /hangmangame.py | UTF-8 | 7,947 | 2.75 | 3 | [] | no_license | import random
##big hangman
print(" _ _ _ _ _____ __ __ _ _ ")
print(" | | | | /\ | \ | |/ ____| | \/ | /\ | \ | |")
print(" | |__| | / \ | \| | | __ | \ / | / \ | \| |")
print(" | __ | / /\ \ | . ` | | |_ | | |\/| | / /\ \ | . ` |")
print(" | | | |/ ____ \... | true |
97fa939fdfb592a3fd1d58392a25b01d71070319 | Python | secpanel/rogue-ips-api-actionkit | /python/sample-python.py | UTF-8 | 1,339 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
#Importing modules for HTTPS Connection
import urllib
import httplib
#Importing modules for parsing JSON
import json
def getTheData(key,limit=10,offset=0):
h = httplib.HTTPSConnection('apis.secpanel.com');
h.request('GET', '/rouge-ips-json.php?key='+str(key)
... | true |
104a5cb3a05e08a5c6711cbe1cb016390eda0337 | Python | christopherjmedlin/discord-auto-responder | /autoresponder.py | UTF-8 | 1,495 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3.6
from discord import Client
from discord.errors import LoginFailure
import asyncio
import configparser
from getpass import getpass
import os
import json
client = Client()
message_map = {}
default_message = "¯\_(ツ)_/¯"
@client.event
async def on_ready():
print('\033[92m\nLogged in as\033[9... | true |
036b6c1937c2ed7fcfbdd130ff5ca534de4bfea5 | Python | mikkolaj/wdi | /zestaw2/elo.py | UTF-8 | 130 | 3.671875 | 4 | [] | no_license | def pow(a, n):
c=1
for i in range(1,n+1):
c*=a
return c
tab = [1, 2, 3, 4]
for i in tab:
print(pow(i, 2))
| true |
d60bb5ca6f525b09635ce23c691fce60a0a0616d | Python | jumpjumpdog/CrawlAmazon | /learnRe.py | UTF-8 | 255 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
def reFunc(str):
matchObj = re.search(r'(.*?) *:(.*)' ,testStr)
if matchObj:
print matchObj.group(2)
else:
print "no match"+matchObj.group(0)
if __name__ == "__main__":
reFunc(testStr) | true |
9f5755332f61e5252fb802631072cf5aebc0f25d | Python | ojhaanshu87/LeetCode | /139_word_break.py | UTF-8 | 3,540 | 3.875 | 4 | [
"Unlicense"
] | permissive | """
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
Note:
The same word in the dictionary may be reused multiple times in the segmentation.
You may assume the dictionary does not... | true |
be1c504d5a8af1abda460520aea597d4a1221b08 | Python | sam95/python-simple-tasks | /NewForms/app.py | UTF-8 | 1,809 | 2.828125 | 3 | [] | no_license | from flask import Flask
from flask import request
from flask import render_template
import re
app = Flask(__name__)
my_dict = {}
@app.route('/')
def hello_world():
return render_template('index.html')
@app.route('/handle_data', methods=['POST'])
def handle_data():
name = request.form['usr... | true |
0c194ab3ebba4c6f3df6820712c7d67b523f663c | Python | worry1613/dongni-recommendation | /rec-engine/mining/nlp/word2v.py | UTF-8 | 1,833 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @创建时间 : 19/2/2018
# @作者 : worry1613(549145583@qq.com)
# GitHub : https://github.com/worry1613
# CSDN : http://blog.csdn.net/worryabout/
from optparse import OptionParser
from gensim.models import word2vec
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(messag... | true |
9ca6a66d91cc3f90549ecc4e94cf831c0d2a0932 | Python | etmorefish/leetcode | /剑指offer/52_两个链表的第一个公共节点.py | UTF-8 | 967 | 3.71875 | 4 | [] | no_license | """
解题思路:
我们使用两个指针 node1,node2 分别指向两个链表 headA,headB 的头结点,
然后同时分别逐结点遍历,当 node1 到达链表 headA 的末尾时,
重新定位到链表 headB 的头结点;当 node2 到达链表 headB 的末尾时,
重新定位到链表 headA 的头结点。
这样,当它们相遇时,所指向的结点就是第一个公共结点。
"""
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = N... | true |
fd38551e4c98de8cf7702aaaa3397d93f2cf3bee | Python | abulkairhamitov/TrainingInDataScience | /workWithData/oneDimensionalData.py | UTF-8 | 2,438 | 3.71875 | 4 | [] | no_license | from typing import List, Dict
from collections import Counter
import math
import matplotlib.pyplot as plt
import random
def bucketize(point: float, bucket_size: float) -> float:
"""Округлить точку до следующего наименьшего кратного размера интервала bucket_size"""
return bucket_size * math.floor(point / bucket... | true |
c55c9171dda8e44ca6ef6fe6ff903b085c817658 | Python | souhardya1/Single-LinkedList-in-python | /MergeSoort on LinkedList.py | UTF-8 | 1,594 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 23 19:47:35 2020
@author: Souhardya
"""
class Node:
def __init__(self,data):
self.data=data
self.next=None
class LinkedList:
def __init__(self):
self.head=None
def push(self,new_data):
new_node=Node(new_data)
... | true |
693fa52ac2f688324e5f645886d28f4b56761e69 | Python | ajinkyapuar/loonycorn-zero-to-one | /FizzBuzz.py | UTF-8 | 306 | 3.609375 | 4 | [] | no_license | # % by 3 Fizz
# % by 5 Buzz
# % by 3 & 5 FizzBuzz
# For instance, the result will look something like this for 1 to 20.
# 1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7, 8, 'Fizz', 'Buzz', 11, 'Fizz', 13, 14, 'FizzBuzz', 16, 17, 'Fizz', 19
['Fizz' * (i % 3 == 0) + 'Buzz' * (i % 5 == 0) or i for i in range(1, 20)]
| true |
0e5d83bef70536fadaa679a85c45e5ee489856b1 | Python | ucsd-cse-spis-2020/SPIS-Final-Project-Theodore-Nikunj | /python/card.py | UTF-8 | 411 | 3.140625 | 3 | [] | no_license | import os
import pygame
class Card:
def __init__(self, value, suit):
self.value = value
self.suit = suit
self.face = pygame.image.load(os.path.join("assets", str(self.value) + self.suit + ".png"))
self.back = pygame.image.load(os.path.join("assets", "Gray_back.jpg"))
def __str__... | true |
d23e7dd1643136cea5688e69ac931443b446d4ba | Python | adison330/testdemo | /test013.py | UTF-8 | 177 | 3.5625 | 4 | [] | no_license | #! /usr/bin/env python
num_str = "1234567890"
print(num_str[2:6])
print(num_str[2:])
print(num_str[:6])
print(num_str[ : ])
print(num_str[ : : 2])
print(num_str[1: : 2])
| true |
f3041393fc436eaa8369623c92d35454bec4ea12 | Python | lanzo-siega/FooDD-classification | /preparation.py | UTF-8 | 2,456 | 2.890625 | 3 | [] | no_license | import numpy as np
import os
from matplotlib import pyplot as plt
import cv2
import random
import pickle
file_list = []
class_list = []
direct = '/path/to/dataset'
cat = os.listdir('/path/to/dataset')
# identifies the subfolders that contain the images we will use
for category in cat:
path = os.path.join(direct, ... | true |
4415ccb6e30df451774e71035ac00e2b0c500d0f | Python | mh-rahman/Programming-Practice | /78. Subsets.py | UTF-8 | 594 | 2.78125 | 3 | [] | no_license | class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
res = [[]]
if not nums:
return res
res+=[[c] for c in nums]
for _ in range(2**len(nums)):
res+=[s+[c] for s in res for c in nums if s and c not in s and c>s[-1] and s+[c] not in res]
... | true |
3237fd9296bda93a3196eeecf039920b8a16a93c | Python | zggl/wax-ml | /wax/modules/gym_feedback.py | UTF-8 | 3,205 | 2.734375 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | # Copyright 2021 The WAX-ML Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | true |
baaeb53954f9968aa717c8bd46f1a735bed89b8e | Python | valar-m0rghulis/Python | /Infosys-Foundation-Program/MODULES/Module_3_Python_DB_Integration/Assignment_9.py | UTF-8 | 897 | 2.75 | 3 | [] | no_license |
import cx_Oracle
# 3)Invalid Username
#con = cx_Oracle.connect('infosysdb/admin@localhost/xe')
#OUTPUT :
#cx_Oracle.DatabaseError: ORA-01017: invalid username/password; logon denied
con = cx_Oracle.connect('infosys/admin@localhost/xe')
cur = con.cursor()
# 1) Invalid Column Name
#cur.execute("DELETE FROM us... | true |
c6e9710a737653961fc1e9e46c1759b0a1a05198 | Python | SabiKov/OpenCvPython | /chapter4_getting_and_setting/getting_and_setting.py | UTF-8 | 899 | 3.171875 | 3 | [] | no_license | # import necessary packages
from __future__ import print_function
import argparse
import cv2
# Read in CLI argument
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image",
required=True,
help="Path to the image")
args = vars(ap.parse_args())
image = cv2.imread(args["image"])
cv... | true |
a173d0e7723830d47161dc44165c340f37afe9be | Python | developyoun/AlgorithmSolve | /programmers/가장큰수.py | UTF-8 | 149 | 3.0625 | 3 | [] | no_license | def solution(numbers):
answer = ''.join(sorted(map(str, numbers), key=lambda x:x*3, reverse=True))
return '0' if answer[0] == '0' else answer | true |
a914abb498757a720dd3ff0d04b4b790e1871a52 | Python | loisks317/TitanicBlogCode | /LoisTitanic.py | UTF-8 | 1,688 | 3.21875 | 3 | [] | no_license | # LoisTitanic.py
#
#
# LKS, December 2016
#
#
# imports
import pandas as pd
import numpy as np
# load in file into a pandas dataframe
df=pd.read_csv('Titanic.csv')
#
# first, let's clean up our data set
df=df.dropna()
# then let's put the solution off to the side
# and drop the labeled 'male/female' column in favor ... | true |
790bb70db4d56db1a08e677b5be6b4a6977974ec | Python | pablodarius/mod02_pyhton_course | /Python Exercises/ejercicios varios.py | UTF-8 | 655 | 3.921875 | 4 | [] | no_license | # Ejercicio 6.1. Escribir un ciclo que permita mostrar los caracteres de una cadena del final al principio.
word = "cagadutaz"
wordRev = ""
for l in range(len(word)-1, -1, -1):
wordRev += word[l]
print(wordRev)
#########################################################
counterA = 0
counterE = 0
counterI = 0
counte... | true |
9f89672c06c0abdda9fd420e187be2552e4360d4 | Python | MICROBAO/cs61a | /disussion3.py | UTF-8 | 107 | 2.953125 | 3 | [] | no_license | # # Discussion 2
# 1.1
def multiply(m, n):
if m == 0 or n == 0:
return 0
return m + multiply(m, n - 1) | true |
cbcf116e84f1c58e411a2727a83cb7ca64ce247f | Python | chaocharliehuang/FlaskMySQLRESTfulUsers | /server.py | UTF-8 | 3,030 | 2.640625 | 3 | [] | no_license | from flask import Flask, request, redirect, render_template, session, flash
from mysqlconnection import MySQLConnector
import re
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
app = Flask(__name__)
app.secret_key = 'secret'
mysql = MySQLConnector(app, 'semirestfulusersdb')
@app.route('/us... | true |
f3c3896904ce6bf0ccb6e310afe9280978af1c30 | Python | DongHuaLu/mdcom | /mdcom/MHLogin/analytics/forms.py | UTF-8 | 343 | 2.671875 | 3 | [] | no_license |
from django import forms
months = (
(1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
(6, 6), (7, 7), (8, 8), (9, 9), (10, 10),
(11, 11), (12, 12),
)
years = (
(2009, 2009),
(2010, 2010),
(2011, 2011),
)
class MonthForm(forms.Form):
"""MonthForm class
"""
month = forms.ChoiceField(months)
year = for... | true |
b971f72dd3a9890ce91c1fb533b3b8ad6bbeb687 | Python | chenxiang97/study_base | /python_study/study_mooc/study_4.2.1.py | UTF-8 | 240 | 3.28125 | 3 | [] | no_license | s = "PYTHON"
while s != "":
for c in s :
if c == "T" :
break
print(c, end="")
#去除最后一个字符串
s = s[:-1]
"""
for c in "PYTHON":
if c == "T":
break
print(c, end="")
""" | true |
27a7317d238d29d240d1dfabc7ebf6e6b3bb89a2 | Python | wdudek82/sqlite_importer | /sqllite_importer.py | UTF-8 | 734 | 2.875 | 3 | [] | no_license | from collections import Counter
import sqlite3
import re
import requests
conn = sqlite3.connect('../../sql1.sqlite')
cur = conn.cursor()
trunkate_table = cur.execute('''DELETE FROM Counts;''')
req = (requests.get('http://www.pythonlearn.com/code/mbox.txt').content).decode('utf8')
emails = Counter(re.findall(r'From:... | true |
5670ed8dfcc50f803bd4283b2c654eb2092e92ce | Python | lin-zone/scrapyu | /scrapyu/utils.py | UTF-8 | 1,439 | 2.59375 | 3 | [
"MIT"
] | permissive | import re
from urllib.parse import urlparse
from selenium import webdriver
def get_base_url(url):
result = urlparse(url)
base_url = '{}://{}'.format(result.scheme, result.netloc)
return base_url
def get_domain(url):
result = urlparse(url)
return result.netloc
_cookies = dict()
def _get_fire... | true |
c984f7b15c5df08a0f85e6e56187b90fb81d4871 | Python | dombrno/irbasis | /test/python/ref/make_unl_safe.py | UTF-8 | 3,262 | 2.546875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | from __future__ import print_function
import os
import argparse
import numpy
import h5py
import irlib
import scipy.integrate as integrate
from mpmath import *
class BasisSet(object):
def __init__(self, h5file, prefix_name):
self._h5file = h5file
self._prefix_name = prefix_name
def _w... | true |
64514ee6172616461fbc71ab5b05e29987b314f0 | Python | alyssa1996/CodingExercise | /Algorithm/이진탐색/[이코테2021] 떡볶이 떡 만들기.py | UTF-8 | 346 | 3.140625 | 3 | [] | no_license | import sys
n,m=map(int,input().split())
rice=list(map(int,sys.stdin.readline().split()))
rice.sort()
start,end=0,rice[-1]
result=0
while start<=end:
mid=(start+end)//2
total=0
for i in rice:
if i>mid:
total+=i-mid
if m<=total:
result=mid
start=mid+1
else:
... | true |
81d77d9ed24954a3cf75bed722c57fd1d2062983 | Python | ishikalamba222/tathastu_week_of_code | /string.py | UTF-8 | 79 | 3.046875 | 3 | [] | no_license | a=set([1,2,3,4])
b=set([6,7,8,3,1])
print(a.union(b))
print(a.intersection(b))
| true |
e717f32213e058c59888bd7d5e871e8669379d97 | Python | TTheof/potential-winner-nome-randown-dado-pelo-site | /aaaaf.py | UTF-8 | 377 | 3.390625 | 3 | [] | no_license | import random
aa = [0,1]
a= random.choice(aa)
# de manha a tarde
almoço= [['só arroz','miojo','carne','ovo cozido','ovo frito'],['maça','café','chá','bolo']]
if a>0:
print ('a tarde eu vou comer/beber')
else:
print ('de manha eu vou comer/beber')... | true |
096817ecc08b129bba7a6c972418d2739dfe137d | Python | dsmrt/web-crawler | /src/utils/test_parse.py | UTF-8 | 457 | 3.046875 | 3 | [] | no_license | from parse import parse_html
def test_parse_html():
html = '''
<!DOCTYPE html>
<html>
<body>
<nav>
<a href="/blog">Blog</a>
<a href="/about">Here is my real website</a>
<a href="https://dsmrt.com">Here is my real website</a>
<a href="https://github.com/dsmrt">@dsmrt on github</a>
</nav>
<h1>Welcome... | true |
296116a909bd45d76ec8a1d09c31290a5a30671a | Python | tiffanyposs/pythonNotes | /programs/listModifiers.py | UTF-8 | 137 | 3.375 | 3 | [] | no_license | x = [1, 2, 3]
print x.pop(1)
#2
print x
#[1,3]
y = [1, 2, 3]
print y.remove(1)
#1
print y
#[2,3]
z = [1, 2, 3]
del(z[1])
print z
#[1,3] | true |
27e47e409a8018f222157cacb16e39230821ded8 | Python | theNicelander/advent-of-code-2020 | /day03/day03.py | UTF-8 | 1,293 | 3.78125 | 4 | [] | no_license | import numpy as np
from utils.files import read_data_into_list
class Slope:
def __init__(self, input_path):
self.slope = read_data_into_list(input_path)
self.slope_length = len(self.slope)
self.slope_width = len(self.slope[0])
def broaden_slope(self):
self.slope = [line + lin... | true |
d3d9b6d22491850605907553895dc0396221843e | Python | roooooon/HW3_ABC | /code/complex_numbers.py | UTF-8 | 717 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import import_ipynb
from Random import Rand
import math
# In[2]:
class ComplexNumber:
def __init__(self):
self.real = Rand()
self.imaginary = Rand()
def c_In(self, file):
with open(f"{file}.txt", "a+") as f:
... | true |
ac7c2f43db21a9989f0d1d8b09fa0ce6368b8e50 | Python | wysocki-lukasz/CODEME-homework | /02_Zmienne i typy/0_Zadanie_1.py | UTF-8 | 382 | 3.984375 | 4 | [] | no_license | #Oblicz koszt wyprawy znając dystans, spalanie na 100km i cenę litra benzyny.
# Załóżmy, że spalanie na 100km wynosi 6,4 l, trasa to 120km, litr benzyny kosztuje 5,04 zł.
fuel_consumption = 6.4
distance = 120
price_per_litr = 5.04
travel_cost = round(float(distance/100 * fuel_consumption * price_per_litr),2)
print(... | true |
7371a4f2fb203dc923dc5fdeef7d84c3870f9678 | Python | anujdutt9/Machine-Learning | /Linear Regression/LinearRegressionGradientDescent.py | UTF-8 | 3,273 | 4.1875 | 4 | [] | no_license | # Linear Regression using Gradient Descent
# In this tutorial, we will be writing the code from scratch for Linear Regression using the Second Approach that we studied i.e. using Gradient Descent and then we will move on to plotting the "Best Fit Line".
# So, let's get started.
# Import Dependencies
import numpy as ... | true |
07b6e6d27d4dd0ff29f0f7a2035da654165c6334 | Python | CasCard/FlappyBird | /flappybird.py | UTF-8 | 4,733 | 2.8125 | 3 | [] | no_license | import pygame
import os
import time
import neat
import random
WIN_WIDTH = 500
WIN_HEIGHT = 800
pygame.display.set_caption("Flappy Bird")
BIRD_IMGS = [pygame.transform.scale2x(pygame.image.load(os.path.join("imgs", "bird1.png"))),
pygame.transform.scale2x(pygame.image.load(os.path.join("imgs", "bird2.png"... | true |
bf67e37c0a817c689b63d8e1beb3e794a6aa7ed0 | Python | Antiger2005/mst | /tools/check_with_diff.py | UTF-8 | 2,473 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
from check_output import extract_answer
from mstutil import get_path_to_checker_binary, get_path_to_mst_binary, get_path_to_project_root
from mstutil import die, quiet_remove, random_tmp_filename
import os, sys
def main(argv=sys.argv):
if len(argv) != 2:
die("""usage: check_with_diff... | true |
86d28f536aa7cba0f006c0d5912924a25c2e1ef4 | Python | dixonaws/PowerCo | /PowerCoAPITest.py | UTF-8 | 2,581 | 2.875 | 3 | [] | no_license | __author__ = 'dixonaws@amazon.com'
# import statements
from sys import argv
import urllib2
import urllib
import time
import sys
import json
def getInvoice(invoiceNumber):
invoiceUrl="http://localhost:8080/RESTTest/api/invoices/" + str(invoiceNumber)
startTime=int(round(time.time() * 1000))
endTime=0;
... | true |
ba9e0506e21dd573e17525591ee6e2a318392973 | Python | ahmad307/NearestPlace | /NearestPlace/locations/views.py | UTF-8 | 3,375 | 2.625 | 3 | [] | no_license | from django.shortcuts import render, HttpResponse
from locations.gmaps import LocationFinder
from locations.models import Session, Location
from django.core.exceptions import ValidationError
from django.core.exceptions import ObjectDoesNotExist
import json
import secrets
import string
from decimal import *
def home(r... | true |
b4a5092ecafcd6304fd15774cf9369eef07b4ecb | Python | DenisPitsul/SoftServe_PythonCore | /video2/Task1.py | UTF-8 | 178 | 4.125 | 4 | [] | no_license | fuelCapacity = float(input("Input fuel capacity: "))
fuelAmount = float(input("Input fuel amount: "))
if fuelCapacity*0.1 > fuelAmount:
print("Red")
else:
print("Green") | true |
9fb879e762bd95c6c858afc627988f3ad95643fd | Python | dlemvigh/GoogleCodeJam | /PythonCodeJam/PythonApplication1/rev_word.py | UTF-8 | 141 | 2.96875 | 3 | [] | no_license | def solve(file):
line = file.readline()[:-1]
words = line.split(" ")
words.reverse()
line = ' '.join(words)
return line
| true |
30a1a5cfad2832e3deaa83403f7c18ed47a677e8 | Python | domtom1126/bail_flask | /app.py | UTF-8 | 1,886 | 2.625 | 3 | [] | no_license | from flask import Flask, render_template
from flask_wtf import FlaskForm
from wtforms import StringField, SelectField, RadioField, SubmitField
from wtforms.validators import InputRequired
from bail import X_test, y_test, plea_list
import joblib
# SECTION Class for input form
class BailForm(FlaskForm):
class Meta:
... | true |
fe2c90c5adaf7286499a451e83292fcbd08355e5 | Python | srisaimacha13/rg_assignments | /Assign_2/avg_of_positive_int_instring.py | UTF-8 | 886 | 3.796875 | 4 | [] | no_license | class MyError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
import re
try:
input_string = raw_input('Enter a String:\n')
if not input_string:
raise MyError('String is empty.')
list_of_integers =... | true |
137d289a6de9926bf66ba5775034d2fb18a1e7f6 | Python | shine914/mutual_fund_network | /3.3-stock_status_summary.py | UTF-8 | 3,213 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#avoid chinese mess
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import glob,os
import xlrd
import networkx as nx
from networkx.algorithms import bipartite
import numpy as np
import pandas as pd
import pandas as pd
import numpy as np
import glob,os
import math
from math import ... | true |
fdf86d8b3c982927ca16c6684f4711034e5d4261 | Python | autasi/tensorflow_examples | /tools/mnist_dump.py | UTF-8 | 1,341 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from tensorflow.examples.tutorials.mnist import input_data
import numpy as np
import pickle
import os
from config import mnist_data_folder
def convert(imgs, img_size, data_format="channels_first"):
if data_format == "channels_first":
data = np.reshape(imgs, [imgs.shape[0], 1, img_... | true |
642aedb66a4aaac409a40e5ae1a3c85b4b84fe7a | Python | Anthonymcqueen21/Algorithms-in-Python | /Python Interview Questions/Reverse_string.py | UTF-8 | 558 | 3.9375 | 4 | [] | no_license | # Here you are given a string as an input and you have to return the input and make sures its reversed
# Python Implementation
class Solutiion(object):
def reverseString(self,s):
string = list(s)
i, j = 0, len(string) - 1
while i - j:
string[i], string[j] = string[j] = st... | true |
7bf704c5f68aa33cc56c80004fb92bb1bccfb09d | Python | Jenkins-manager/Jenkins | /Server/q_and_a_script.py | UTF-8 | 4,660 | 2.8125 | 3 | [] | no_license | """
run this file to create and implmenet a new question /
answer pair. enter the following details to create a
complete pair:
- question body
- answer body (should be a function ideally)
- question keywords (at least one)
"""
import sys
import ast
import django
django.setup()
fr... | true |
bb1ac084fd16c1c817496113db8820741c65205c | Python | Chris-Quant/TeamCo | /7. Machine Learning Prediction/main_ml.py | UTF-8 | 6,539 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 7 16:07:34 2016
@author: ZFang
"""
from datetime import datetime
import pandas_datareader.data as wb
import pandas as pd
import numpy as np
from sklearn import svm
def cal_return(p):
daily_return = (p['Adj Close'] - p['Adj Close'].shift(1))/p['Adj Close']
ret... | true |
867f3dae4e7945b3f3613e6ac51a6fec665ce5cf | Python | elenarangelova/Phyton-course-in-Softuni | /lesson2/5task.py | UTF-8 | 3,686 | 3.4375 | 3 | [] | no_license | #Да си направим програмка за запознанства.
#В едно list-че сме си съчинили малко информация за момиченца и момченца.
# От данните, програмата трябва да изведе резултати кои хора биха си паснали,
# съгласно следните правила:
#момиченце с момченце; ако сте по-свободомислещи, можете да комбинирате
# и момченце с момченце,... | true |
1267d97b762caaa0bbebbfe53d5452cbb07d19e3 | Python | tecWang/knowledges-for-cv | /剑指offer/Codes/31_把数组排成最小的数_贪心.py | UTF-8 | 331 | 3.515625 | 4 | [
"Apache-2.0"
] | permissive | # -*- coding:utf-8 -*-
class Solution:
def PrintMinNumber(self, numbers):
# write code here
arr = [num for num in numbers]
arr.sort()
print(arr)
return "".join([str(a) for a in arr])
print(Solution().PrintMinNumber([1, 12, 123]))
print(Solution().PrintMinNumber([3,... | true |
391ecaf2c5a2c6cb7d0bdfbedd386c7c3f624daa | Python | BishuPoonia/coding | /Python/diagonal_difference.py | UTF-8 | 506 | 3.84375 | 4 | [] | no_license |
def diagonal_difference(arr):
r1, r2 = 0, 0
for i in range(n):
T = list(map(int, arr[i]))
r1 += T[i]
r2 += T[-i -1]
return abs(r1-r2)
n = 3
arr = [[11, 2, 4],
[4, 5, 6],
[10, 8, -12]]
result = diagonal_difference(arr)
print(result)
''''
a = []... | true |
b9fbb46514e0cfe298833e764053b5812239a883 | Python | tarcisioLima/learnpython | /oo/class-attributes.py | UTF-8 | 544 | 3.96875 | 4 | [] | no_license |
class A:
vc = 123
# Inicializa logo quando instancia, caso não seja instanciado, não altera a variavel da classe.
def __init__(self):
self.vc = 111
a1 = A()
a2 = A()
# Muda para todas as instancias
A.vc = 321
# Muda apenas para a instancia
a1.vc = 9090
# R: {'vc': 9090}
print(a1.__dict__)
# R:... | true |
b7d804c2e51e897e67ceaa18a3dd085979fac964 | Python | Binny-bansal/PYTHON | /day1.py | UTF-8 | 1,085 | 3.6875 | 4 | [] | no_license | # print("Binny!", end=" ")
# print("Riya")
# # num = int(input("Enter a number: "))
# # print(num)
# # print(2**5)
# money = 100
# item = 90
# chocolate = 20
# if(money-item >= chocolate):
# print("Yes! We can buy chocolate.")
# elif(money-item < 20):
# print("You're low on money!")
# n... | true |
5196a37332132bd2147c4f43a4ac0f59bd27e37d | Python | josehuillca/Analise_de_Imagens | /help_functions/canny.py | UTF-8 | 4,611 | 2.875 | 3 | [] | no_license | import numpy as np
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages')
import cv2
def create_image(shape, dtype, nchanels):
img = np.zeros([shape[0], shape[1], nchanels], dtype=dtype)
r, g, b = cv2.split(img)
img_bgr = cv2.merge([b, g, r])
return img_bgr
def single_band_representation... | true |
2e81257ce1118b2c93aa128e8f9c17d042176eb6 | Python | tiagodrehmer/TCC | /util.py | UTF-8 | 28,635 | 2.515625 | 3 | [] | no_license | import cv2
import numpy as np
import math
from sklearn.cluster import KMeans
import operator
w = 1280
h = 720
amarelo = (0,255,255)
vermelho = (0,0,255)
azul = (255,0,0)
branco = (255,255,255)
preto = (0, 0, 0)
font = cv2.FONT_HERSHEY_SIMPLEX
bottomLeftCornerOfText = (640,360)
fontScale ... | true |
99fd77bb00149b104ff5d79d0ce09d66a8c25348 | Python | Sneha-singh-pal/simple-linear-regression-ML-model | /model.py | UTF-8 | 310 | 2.890625 | 3 | [] | no_license | import pandas
import sklearn.linear_model from LinearRegression
db = pandas.read_csv("dataset.csv")
X= db["hrs"].values.reshape(-1,1)
Y= db["marks"]
mind = LinearRegression()
mind.fit(X,Y)
hours= int(input("enter the no of hours you study :" ))
print("your marks wil be approx :" ,mind.predict([[hours]]))
| true |
bc94346808f3594db3765b392e5e70638399d2a5 | Python | TheAlgorithms/Python | /project_euler/problem_107/sol1.py | UTF-8 | 4,211 | 4.15625 | 4 | [
"CC-BY-NC-4.0",
"CC-BY-NC-SA-4.0",
"MIT"
] | permissive | """
The following undirected network consists of seven vertices and twelve edges
with a total weight of 243.

The same network can be represented by the matrix below.
A B C D E F G
A - 16 12 21 - - -
B 16 - - 17 20 - -
C 12 - - 28 - 31 -
D 21 17 28 - 18 19 23
... | true |
f20273465bac34792f2557e7d1d541c3cddba586 | Python | harshsd/NUS-Intern | /Codes/Final_Codes_Folder/svm.py | UTF-8 | 4,971 | 3.09375 | 3 | [] | no_license | from sklearn import svm
import os
import numpy as np
import matplotlib.pyplot as plt
def accuracy_svm (data_set1 , data_set2 , cc , gg):
'''Returns average accuracy of a svm after doing 5 fold validation on the given datasets.Uses rbf kernel. To edit change on line 53
Args:
data_set1 : The first data_set. All the... | true |
43b894b28b62f5eafaadb23ce4a531dfeb9bec70 | Python | zeeking786/BSCIT_PYTHON_PRACTICAL | /PRACTICAL-6/Pract_3.py | UTF-8 | 206 | 3.609375 | 4 | [] | no_license | """
Write a Python program to read last n lines of a file.
"""
def read_lastnlines(fname,n):
with open('file.txt') as f:
for line in (f.readlines() [-n:]):
print(line)
read_lastnlines('file.txt',2)
| true |
16137fd90e2e3200aced5322f2ca4e2fa43195d9 | Python | simonecampisi97/Voiced-Unvoiced_Speech_Detection | /frontend/GUI.py | UTF-8 | 4,714 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import tkinter as tk
import tkinter.ttk as ttk
from tkinter import font as tkfont
from frontend.HomePage import HomePage
from frontend.GraphicPage import GraphicPage
from frontend.NeuralNetworkPage import NeuralNetworkPage
from frontend.Settings import *
from frontend.Tooltip import ToolTip
class App(tk.Tk):
def... | true |
cc6e6d007b5795082fb99b378b4cb3e60380cb68 | Python | Xg2Acte1Train/01.dl_nithya | /14_softmax_classifier.py | UTF-8 | 1,848 | 2.6875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from random import randint
mnist = input_data.read_data_sets("MNIST_data/data", one_hot=True)
print (mnist.train.images.shape)
print (mnist.train.labels.shape)
print (mnist.te... | true |
25c569ad8eefe42a118ce61812f1a34f40af6ca0 | Python | sowrd299/AccountantsFriend | /taped_adding_machine.py | UTF-8 | 1,547 | 3.234375 | 3 | [] | no_license | from adding_machine import AddingMachine, CharOp
'''
A class to represent an entry on the tape
'''
class TapeEntry():
fstr = "{0} {1}\n"
def __init__(self, number, op):
self.number = number
self.op = op
def __str__(self):
return self.fstr.format(self.number, self.op)
class TextT... | true |
5f53b8b4507a3c51d2e608ed7098ad749428b27e | Python | Danbrose/CV_in_Squash | /code/centroid_tracker_video.py | UTF-8 | 2,671 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
from centroidtracker import CentroidTracker
import json
import itertools
import numpy as np
import cv2
import time
import glob
import os
import sys
from frame_draw import frame_draw
ct = CentroidTracker()
# collects key point files files and puts them in to an ordered list
files = []
for filepa... | true |
f5d1ea38dd1cdd4402fde9a4a1406f11f063f600 | Python | PyLamGR/PyLam-Edu | /Workshops/11.03.2018 - Python. The Basics - Volume 2 -/Python Codes/8. Αντικειμενοστρεφής Προγραμματισμός/3_another_hierarchy_example.py | UTF-8 | 250 | 3.515625 | 4 | [
"MIT"
] | permissive | class Wolf:
def __init__(self, name, color):
self.name = name
self.color = color
def bark(self):
print("Grr...")
class Dog(Wolf):
def bark(self):
print("Woof!")
husky = Dog("Max", "grey")
husky.bark()
| true |
2f5c47cfb175172e04550310d99cbeea8e18c483 | Python | montoyamoraga/ai-rapper | /script.py | UTF-8 | 2,183 | 2.609375 | 3 | [
"MIT"
] | permissive | # import libraries
# time for delays
import time
# os for sending commands to bash terminal
import os
# midi library
# pip3 install mido
import mido
# midi library
# pip3 install python-rtmidi
import rtmidi
# read .txt files and strip new line characters
textLil = [line.rstrip("\n") for line in open('lil-wayne.txt')]
... | true |
d390c40f7ba739fc393d514ba8b37961548f720a | Python | pktangyue/LeetCode | /python/1535_FindTheWinnerOfAnArrayGame_test.py | UTF-8 | 649 | 3.421875 | 3 | [] | no_license | import unittest
class TestSolution(unittest.TestCase):
def test_getWinner(self):
Solution = __import__('1535_FindTheWinnerOfAnArrayGame').Solution
self.assertEqual(
5,
Solution().getWinner(arr=[2, 1, 3, 5, 4, 6, 7], k=2)
)
self.assertEqual(
3,
... | true |
f26751d82b370db73e16e73402391096c3454446 | Python | eclubiitk/Li-Fi-E-Club | /Old Codes/FTP v1.0/pyLi-Fi.py | UTF-8 | 5,297 | 2.703125 | 3 | [] | no_license | import serial
import time
import os
recport=input('{:<25}'.format("Input Receiver Port : "))
traport=input('{:<25}'.format("Input Transmitter Port : "))
ser = serial.Serial()
ser.baudrate=230400
ser.port=recport #Receiver-(Slave/Master)
ser.open()
serftr = serial.Serial()
serftr.baudrate=9600
serftr.port=traport #Tr... | true |
a591f1679b7cf70f4b7b759cd7f7beec999bee3b | Python | garbhitjain/problem-statement | /date to day converter.py | UTF-8 | 1,712 | 3.3125 | 3 | [] | no_license | import calendar
import datetime as dt
import pandas as pd
start = dt.datetime(1970,1,1)
End = dt.datetime(2100,1,1)
dates = pd.date_range(start,End)
def solution(D):
out={'Mon':0,'Tue':0,'Wed':0,'Thu':0,'Fri':0,'Sat':0,'Sun':0}
lis = []
for i,j in D.items():
a,b,c=i.split('-')
y,m,d=int(a),... | true |
e2e4b619de107749b5761b6a78a3473002de7169 | Python | wjdrkfka3/Valorant_Team_Maker_Python | /main.py | UTF-8 | 11,092 | 3.015625 | 3 | [] | no_license | # PyQT 5.0 버전과, 아나콘다 Python 3.6 버전을 사용했습니다.
# PyCharm을 사용하는 경우 File->Settings->Project Interpreter 를 아나콘다 Python 3.6으로 설정해줘야 코드가 올바르게 동작합니다.
import sys
import random
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
class MyApp(QWidget):
def __init__(self):
super().__... | true |
1d2ea1012518151e6549e8b681270fda57f14804 | Python | 1205-Sebas/TALLERCV-GOMEZ-DIAZ | /Ejercicio6.py | UTF-8 | 926 | 3.90625 | 4 | [] | no_license | """
6. Elaborar un algoritmo que permita realizar el inventario de una tienda, es decir cuántas unidades de
cada tipo de producto existen actualmente en la tienda. Se debe imprimir una lista ordenada de
productos de menor a mayor cantidad.
"""
import operator
a=int(input("Cantidad Aceite:"))
b=int(input("Cantida... | true |
65b6944385052d0871663a9f4e1a28e6b5331e10 | Python | tmu-nlp/NLPtutorial2017 | /bambi/tutorial13/beam.py | UTF-8 | 3,019 | 2.640625 | 3 | [] | no_license | from collections import defaultdict
import math
file = "../../data/wiki-en-test.norm"
emission = defaultdict(int)
transition = defaultdict(lambda: 1) # 1 to prevent log(0) raise math domain error and the log(1) == 0
possible_tags = defaultdict(int)
def key(*names):
return " ".join(map(str,names))
def cal_score(... | true |
9d260d8f40d3fc5766021687182d98bffa53be91 | Python | alisonflint/urban-data-challenge-sf | /sf-urban-transit/extract_d3_graph.py | UTF-8 | 1,193 | 2.671875 | 3 | [] | no_license |
import csv
import json
import gzip
import sys
STOPID = 1
ON = 3
OFF = 4
LOAD = 5
MONTH = 6
DAY = 7
YEAR = 8
TIMESTOP = 15
TIMEDOORCLOSE = 16
TIMEPULLOUT = 17
TRIPID = 18
DATE_FMT = "%H:%M:%S"
def getGraphJson(passenger_count_file):
csv_file = csv.reader(gzip.open(passenger_count_file, 'rb'))
csv_lines = list(... | true |
631121e112aa5e21fa8052c693dbe555c3632c53 | Python | jonathan-carvalho/Modelagem-ARIMA | /code/main.py | UTF-8 | 2,231 | 2.5625 | 3 | [] | no_license | from identificacao import *
from estimacao import *
from diagnostico import *
from graficos_resultado import *
import sys
from pandas import Series
from itertools import product
class Modelo:
p = 0
d = 0
q = 0
pesos_autoregressivos = []
pesos_medias_moveis = []
ruidos_estimados = []
autoco... | true |
d9990cf65a3159d27605298d48406ec611699755 | Python | anastasiia-l/rateskill-backend | /api/utils/twitter_manager.py | UTF-8 | 1,131 | 2.765625 | 3 | [] | no_license | import os
import re
import tweepy
class TwitterManager(object):
def __init__(self):
self.consumer_key = os.environ.get('CONSUMER_KEY', '')
self.consumer_key_secret = os.environ.get('CONSUMER_KEY_SECRET', '')
self.access_token = os.environ.get('ACCESS_TOKEN', '')
self.access_token_... | true |
f6f2f6fe96d8848c3d975c68dddca68d9698a9c1 | Python | ArtemKurchakov/git_home_project | /artem_boxer.py | UTF-8 | 218 | 3.40625 | 3 | [] | no_license | class Boxer():
def __init__(self, age, weight, height):
self.age = age
self.weight = weight
self.height = height
artem = Boxer(34, 100, 187)
print(artem.age, artem.weight, artem.height)
| true |
c77e50903a278db96db61c4ebcea3c2e8ed7ca9e | Python | Aakash-kaushik/machine-learning | /multivariate_linear_regression_normal_equation/multivariate_linear_regression_normal_equation.py | UTF-8 | 855 | 3.015625 | 3 | [
"Unlicense"
] | permissive | import pandas as pd
import numpy as np
from mpl_toolkits import mplot3d
import matplotlib.pyplot as plt
data=pd.read_csv("data2.txt")
nor_data=data#(data-data.mean())/data.std()
nor_data=np.array(nor_data)
x=np.array(nor_data[:,0:2])
y=np.array(nor_data[:,2])
x_one=np.append(np.ones([np.size(x,0),1]),x,axis=1)
#plott... | true |
d277d7e51cb7a846811b1a4d9b1a3516e206aa55 | Python | jonathantsang/CompetitiveProgramming | /binarysearchio/contest10/2.py | UTF-8 | 930 | 3.15625 | 3 | [] | no_license | from collections import defaultdict, deque
# class Tree:
# def __init__(self, val, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def solve(self, root):
leaves = defaultdict(int) # node # -> depth for leaves
q = deque([(... | true |
0182597bbef24e7ae027802d3a768517b5c24cac | Python | AreebsUddinSiddiqui/OOADActivities | /Vehicle.py | UTF-8 | 360 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
#-*- coding: utf-8 -*-
class Vehicle:
def __init__(self):
self.regNo = None
self.Year = None
self.LicenseNo = None
def Forward(self, ):
pass
def Backward(self, ):
pass
def Stop(self, ):
pass
def TurnRight(self, ):
pass
... | true |
cb460913396929324a2ced58b7a29bc4d9459da5 | Python | sibowi/equivariant-spherical-deconvolution | /generate_data/5_nii_to_mif.py | UTF-8 | 2,436 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file convert a nii file into a mif file.
If you find bugs and/or limitations, please email axel DOT elaldi AT nyu DOT edu.
"""
import argparse
import os
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
... | true |
23b07f6c6945667965fdcce7fbc129766448679a | Python | veronicarose27/plaaaa | /aaac.py | UTF-8 | 153 | 3.34375 | 3 | [] | no_license | p=input()
count=0
for i in p:
if(i!='a' and i!='b'):
count=count+1
if(count==1 or count==0):
print('yes')
else:
print('no')
| true |
556c5e31acd4927d9f586c42907cb37a2c760474 | Python | louay-075/CyberBlindTech-python-lessons | /lesson-2.py | UTF-8 | 107 | 3.203125 | 3 | [] | no_license | name = "louay"
last_name = "eloudi"
age = "26"
print "I am " + name + last_name + "and I am" + age | true |
11765e8f0974e8976174b81f0638699d4912e5ed | Python | hegangmas/MySourceLib | /CppCallPy/mymod.py | UTF-8 | 217 | 2.875 | 3 | [] | no_license | import random
def a():
print "func a"
def square(a):
return a**2
def add(a,b):
return a+b
def addString(a,b):
return a*b
def normal(a,b):
return random.normalvariate(a,b);
| true |
887f6cd9b5d3e9b78c77de00e6d2c5009a8d8d70 | Python | juarezpaulino/coderemite | /problemsets/Codeforces/Python/B227.py | UTF-8 | 232 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
n=int(input())
a=[0]*(n+1)
for i,x in enumerate(map(int,input().split())):
a[x]=i
x=y=0
input()
for u in map(int,input().split()):
x+=a[u]+1
y+=n-a[u]
print(x,y)
| true |
3c46dc823b79445c287858cfc2f64f238e5b3e3e | Python | chenzw93/python | /python/python_demo/first/typeOfData.py | UTF-8 | 1,806 | 4.28125 | 4 | [] | no_license | '''
数据类型
整数
浮点数
字符串
list
tuple
dict
set
1. set、dict 只能是不可变类型数据,{}
2. tuple 即为数组,元素个数确定 ()
3. list 可变集合 []
条件判断:
if 条件:执行语句
if 条件: 执行语句 elif 条件: 执行语句 else:执行语句
循环:
while
for xxx in xxx
continue
break
'''
# name = 10
# print(name)
#
... | true |
612a74f5a62ff67027bf82a27dc183a4163b886f | Python | tomboxfan/PythonExample | /exercise/001/P001V3.py | UTF-8 | 125 | 3.09375 | 3 | [] | no_license | # 之前的输出结果不好看
for i in range(1, 5):
for j in range(1, 5):
num = i * 10 + j
print(num) | true |
0eb2cd02f917d217cbe173235b53491a3f7b8905 | Python | fatihyasar/grower-firmware | /relay.py | UTF-8 | 712 | 3.078125 | 3 | [] | no_license | import time
import grovepi
# Connect the Grove Relay to digital port D4
# SIG,NC,VCC,GND
grovepi.pinMode(2,"OUTPUT")
grovepi.pinMode(3,"OUTPUT")
grovepi.pinMode(4,"OUTPUT")
grovepi.pinMode(5,"OUTPUT")
grovepi.pinMode(6,"OUTPUT")
grovepi.pinMode(7,"OUTPUT")
def open(relayNumber):
grovepi.digitalWrite(relayNumber,... | true |