blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
ff715213671ee2b0ae3dbb08a3ec4865b8de3eb5 | abidkhan484/hacerrankScraping | /scrapeHackerrankCode/codes/queue-using-two-stacks320.py | UTF-8 | 247 | 3.296875 | 3 | [] | no_license | # Accepted
# Python 3
mylist = []
n = int(input().strip())
for _ in range(n):
tmp = input().split()
if tmp[0]=='1':
mylist.append(int(tmp[1]))
elif tmp[0]=='2':
mylist = mylist[1:]
else:
print(mylist[0])
| true |
a5e0668dba012958d43aee7445614858b1636885 | 216software/horsemeat | /horsemeat/webapp/bogusrequest.py | UTF-8 | 2,882 | 2.78125 | 3 | [] | no_license | # vim: set expandtab ts=4 sw=4 filetype=python:
import urlparse
class BogusRequest(object):
"""
This class is for testing. I'll keep adding stuff as I need it.
Later, I might figure out how to make this some kind of subclass or
constructor for the regular request object, so that not too much has
... | true |
3652c1dcc5df2eb0efaf0c64c0e56417847286eb | jbj88817/PythonAdv1 | /2/2-4.py | UTF-8 | 389 | 3.671875 | 4 | [] | no_license | # coding=utf-8
from random import randint
d = {x: randint(60, 100) for x in 'xyzabc'}
print d
print list(iter(d)) # 字典的可迭代对象其实是key
# 元组比大小是一个值一个值比较
print (97, 'a') > (69, 'b')
print (97, 'a') > (97, 'b')
res = zip(d.itervalues(), d.iterkeys())
print res
print sorted(res)
# 第二种方法
print sorted(d.items(), key=lambda ... | true |
801468461c6133ce823401f6c93adf23ef8e8caa | batsnap/eduacation | /programming/python/school/pythonзадачиЕГЭ/polyakov79.py | UTF-8 | 136 | 2.65625 | 3 | [] | no_license | n=int(input())
ost=[0]*12
for i in range(n):
a=int(input())
ost[a%12]+=1
for i in range(6,1):
for j in range(1,6):
i | true |
2f49b3ec32008618a59598a82de90f18f7adcd3a | ximas/box-adventure | /Jumping(beta2).py | UTF-8 | 2,053 | 3.109375 | 3 | [] | no_license | #module for my box adventure jump--------------
import pygame
screen=pygame.display.set_mode((600,500))
#variables---------------------------------------------
main_run=1
run=1
down=500
x=100
y=400
#main--------------------------------------------------
while main_run:
screen.fill((0,0,0))
pygam... | true |
1becbf25b3aaef16ed1dcd3b6b4e0853c9a8e0b9 | Litchiyang/machinevision | /SVMtrain.py | UTF-8 | 10,350 | 3.046875 | 3 | [] | no_license | import json
from statistics import mean
import matplotlib.pyplot as plt
with open('output.txt') as fi:
lst = json.load(fi)
length = len(lst)
#data exploratory
#area
areaDict = {}
areaDictMean = {}
for i in range(0,length):
appleSlice = lst[i]
#print(appleSlice)
area = appleSlice[4]
time = apple... | true |
288b49beda97c162829ac73ddd58c3501656753b | skeegv/CRM | /keegv/service/v1.py | UTF-8 | 10,488 | 2.640625 | 3 | [] | no_license | """
1.数据列表页面,定制显示列
示例1:
v1.site.register(Model), 默认只显示对象列表
示例2:
class SubClass(BaseKeegvAdmin):
list_display = []
v1.site.register(Models, SubClass), 按照list_display 中指定的字段进行显示
PS: 字段可以是
- 字符串,必须是数据库里的列名
- 函数,
def comb(self, ... | true |
b566b71cd40c5391500c61891fe163c84f5993f5 | DariaKnyazeva/project_euler | /utils/prime_numbers.py | UTF-8 | 2,115 | 4.25 | 4 | [] | no_license | import math
from typing import Generator, List, Set
def is_prime(number: int) -> bool:
"""
Returns True if the number is prime, False otherwise.
"""
if number % 2 == 0:
return False
for i in range(3, int(math.sqrt(number)) + 1, 2):
if number % i == 0:
return False
... | true |
264a4f0afb8312eebc9f69bf51c0bd4d5782bdb7 | noliosahrak/VatService | /VatService.py | UTF-8 | 884 | 3.125 | 3 | [] | no_license | from numbers import Number
class VatService:
def __init__(self, vat_provider):
self.vat_provider = vat_provider
def get_gross_price_for_default_vat(self, product):
return self.calculate_gross_price(product.get_net_price(), self.vat_provider.get_default_vat())
def get_gross_price(self, n... | true |
cd3527eb47d9673b625a66fd9930e08b2b4aef05 | ShenTongen/Python | /计算器.py | UTF-8 | 900 | 4.0625 | 4 | [] | no_license | print("符号表:1代表【+】 2代表【-】 3代表【*】 4代表【/】 5代表【幂运算】")
#符号声明
a=float(input('请输入第一个数字:'))
f=int(input('请输入符号:'))
b=float(input('请输入第二个数字:'))
if f==1:
c=a+b
elif f==2:
c=a-b
elif f==3:
c=a*b
elif f==4:
c=a/b
elif f==5:
c=a**b
else:
print('-------------------------------------------------------... | true |
e798c2449fdb53e6dc4a0c41ea2395d5e0e9e7c8 | buttegab/FreshmanPlague | /code/network_generator.py | UTF-8 | 1,598 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python
"""
Modified Barabasi-Albert Network Generation, for disease spread simulation.
Complexity Science F2016, Olin College
"""
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
class Student(object):
"""
Base student; used as node in network.
"""
def __init__(self, immu... | true |
32e89a2ce331ff3e60f6f834763595920fd4a04f | patrickziegler/rrr | /rrr/rrr.py | UTF-8 | 2,347 | 2.609375 | 3 | [] | no_license | __version__ = "0.1.2"
import matplotlib.pyplot as plt
import numpy as np
import argparse
def eval_plot(ask_c, vol_min=200, vol_max=2000, risk_max=250, rrr=2, margin=0.08, p=1, res=500, step=2):
bid_d = ask_c * np.linspace(1 - margin, 1, res);
vol = np.linspace(vol_min, vol_max, res);
[vv, dd] = np.mesh... | true |
ee1e9739298fc9d53e6ae157523ff408909ebe13 | FTN-E2-materials/Osnovi-informacionih-sistema-i-softverskog-inzenjerstva | /Python/Vezbe/07 Hash mapa/hashmap_pocetak.py | UTF-8 | 903 | 3.546875 | 4 | [] | no_license | import random
class HashMap(object):
"""
Klasa modeluje heš mapu
"""
def __init__(self, capacity=8):
"""
Konstruktor
Argumenti:
- `capacity`: inicijalni broj mesta u lookup nizu
- `prime`: prost broj neophodan heš funkciji
"""
self._data = capaci... | true |
e15fd5f740bdbb948ed7501132da3c7dae84e6c8 | visweswar299/_291862_python | /remove value from an array.py | UTF-8 | 392 | 3.8125 | 4 | [] | no_license | import array as arr
a=arr.array('i',[0,1,2,3,4,5,6,7,8,9,10,11])
print("Array before insertion:",end=" ")
for i in range(0,12):
print(a[i],end=" ")
print()
a.append(15)
a.append(12)
a.append(10)
print("Array after insertion:",end=" ")
for i in range(0,15):
print(a[i],end=" ")
print()
a.remove(12)
print("Array after r... | true |
fe4aad3eb8a525e5f1c7649ffb9bd45eccc4bfda | KennethIs/lesson6 | /lesson6/problem2.py | UTF-8 | 316 | 4.21875 | 4 | [] | no_license | name = input('What is your name? ')
print('Nice to meet you '+ name + '! My name is Tsering chan!')
age = input('How old are you? ')
print("You're " + age + ' years old? Wow, I was born today.' )
feeling =input('How are you feeling today? ')
print("Really? That sucks, but I'm sure you'll get better by the end of today!... | true |
a8d1ec0d2ea3a47432db5c0719b39348b4b22e3c | spark-examples/pyspark-examples | /pyspark-drop-null.py | UTF-8 | 574 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
author SparkByExamples.com
"""
from pyspark.sql import SparkSession
spark: SparkSession = SparkSession.builder \
.master("local[1]") \
.appName("SparkByExamples.com") \
.getOrCreate()
filePath="resources/small_zipcode.csv"
df = spark.read.options(header='true', inferSchema='tru... | true |
a058effbd3c933492f392cadbd1670afd409d94c | visvmal7/I18Nhelpertool | /project/gothonweb/L10N/tools.py | UTF-8 | 906 | 2.578125 | 3 | [] | no_license | from nose.tools import *
import re
def assert_response(resp, contains=None, matches=None, headers=None, status="200"):
# print "Message %s %s resp and staus from tools" % (resp, status)
print "Message %s from resp " % resp
assert status in resp.status, "Expected response %r not in %r" % (status, resp.stat... | true |
ee46ad20367121336b6786c36b8841902e27eb91 | yasyf/rainbow | /rainbow/models/calendar/calendar.py | UTF-8 | 2,230 | 2.609375 | 3 | [] | no_license | from operator import methodcaller
import icalendar, pickle, bson
from rainbow.helpers.mongo import calendars
class Calendar(object):
VERSION = 2.0
def __init__(self, url: str, type: str, data: str, events):
self.prodid = '-//{}//{}//'.format(self.__class__.__name__, self.__class__.__module__)
... | true |
b7a290b33399fb7f0f9fe988681fde885e5679e7 | imscs21/myuniv | /1학기/programming/basic/파이썬/파이썬 과제/6/6_4.py | UTF-8 | 1,284 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | def merge0(left,right):
if not (left == [] or right == []):
if left[0] <= right[0]:
return [left[0]] + merge0(left[1:],right)
else:
return [right[0]] + merge0(left,right[1:])
else:
return left + right
#실습 8
def merge1(left,right):
def loop(lef... | true |
d3bcbdd46961af5792c4a15e611af5cbd0bee0a4 | xiwang0818/Tracking_and_Detection_in_Computer_Vision_project1 | /task1/plot.py | UTF-8 | 2,488 | 2.921875 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import cv2
import numpy as np
class Drawer:
def __init__(self, scale=0.1):
self.scale = scale
# inner variable: loc_array: valid 3d kp
def draw(self, rvec_list, tvec_list, corners, loc_array):
fig = plt.figure()
ax = fig.add_subplot(111, projection=... | true |
b581ef10d8f4b8aabe29ebc409e368a865ced2a9 | sana-aawan/screen_resolution | /template_matching.py | UTF-8 | 1,012 | 2.828125 | 3 | [] | no_license | import cv2
import pyautogui
method = cv2.TM_SQDIFF_NORMED
# Read the images from the file
small_image = cv2.imread('images/video.PNG')
large_image = cv2.imread('images/vlc.PNG')
h, w = large_image.shape[:2]
sh, sw = small_image.shape[:2]
result = cv2.matchTemplate(small_image, large_image, method)
res_h, r... | true |
21c9be0548a1de7586274fdf28d0b329795caed6 | C0deSamurai/deep-2048-shredder | /play-2048.py | UTF-8 | 331 | 3.4375 | 3 | [] | no_license | """Plays a simple text game of 2048."""
from board import Board
b = Board()
b.add_random_tile()
while not b.game_status():
print(b)
direction = input()
while direction not in "WASD":
direction = input("One of WASD: ")
b.make_move("WDSA".index(direction))
b.add_random_tile()
print(b.game... | true |
da963250bdd9f4a0e02a35562a24898e6cbb5de9 | jae-sang-y/PublicScreen | /2018OCT03/get_food.py | UTF-8 | 1,918 | 2.640625 | 3 | [] | no_license | import re
import urllib.request
def get_food(a):
url = "http://www.dgsw.hs.kr/user/carte/list.do?menuCd=MCD_000000000000029947"
data = urllib.request.urlopen(url).read()
src = data.decode('utf-8')
start = src.find('<ul class="meals_today_list">')
src = src[start + len('<ul class="meals_today_lis... | true |
79ca99e351f61364c5721b81f74e55952981be68 | triklozoid/webchecker | /webchecker/webchecker.py | UTF-8 | 942 | 2.546875 | 3 | [] | no_license | import argparse
import logging
from webchecker.consumer import run_consumer
from webchecker.manager import add_site
from webchecker.producer import run_producer
def setup_logging():
logging.basicConfig(
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
)
def main():
setup_l... | true |
af49a9bec4f151b26418ae87417f59bc3401314a | SjVer/2d-Raycasting | /main.py | UTF-8 | 2,558 | 2.96875 | 3 | [] | no_license | # IMPORTING
import pygame, time, os, sys, math
pygame.font.init()
pygame.mixer.init()
pygame.init()
sys.setrecursionlimit(10000)
clock = pygame.time.Clock()
sys.path.append('/home/sjoerdv/python/modules')
import easycolors as colors
from settings import Settings
settings = Settings()
import maps
# CONTSTANTS
WIN = pyg... | true |
48c839d5eb1acad739a91606860f79b9ed1ac1bb | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/matrix/526b7ccd2d864a99af71fc827f360e16.py | UTF-8 | 324 | 3.328125 | 3 | [] | no_license | class Matrix(object):
def __init__(self, data):
self.rows = [[int(char) for char in line.split()] for line in data.split("\n")]
self.columns = [[row[i] for row in self.rows]
for i in xrange(self.size) ]
@property
def size(self):
return len(self.rows[... | true |
9a7ecb5dd1ddb70d28b6221350aa0591c945324e | lzxsysulzx/learning | /00.py | UTF-8 | 301 | 3.140625 | 3 | [] | no_license | import numpy as np
a=np.array([1,2,3,4])
print("a =",a)
b=np.array([[1,2,3,4],[4,5,6,7],[7,8,9,10]])
print("b =\n", b)
print("dtype of b =", b.dtype)
print("shape of a =", a.shape)
print("shape of b =", b.shape)
c=b.reshape((4,3))
print("c =\n",c)
b[0][2]=100
print("b =\n", b)
print("c =\n", c)
#abc
| true |
44a3e17c7d64a851d6035fded53ccf7ba05ef2d3 | Kostalyeyue/code_management_system | /code_management/code_management/views/test.py | UTF-8 | 1,767 | 3.0625 | 3 | [] | no_license | # # import redis
# #
# # # r = redis.Redis(host='localhost',port='6379')
# # # r.set('wudi','shuai')
# # # print(r.get('wudi'))
# #
# # pool = redis.ConnectionPool(host='127.0.0.1',port='6379')
# #
# # r = redis.Redis(connection_pool=pool)
# # r.set('wu','牛')
# # print(r.get('wu'))
# #
# menu_list = [
# {'id':1,'ti... | true |
7c44b0a16196fe2fe588b7b8b32f435d984f4c29 | adamevansdev/hex2rgb-team-colors | /hex2rgb.py | UTF-8 | 209 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def hex2rgb(hex):
hex = hex.lstrip('#')
hlen = len(hex)
return ' '.join(
map(str, tuple(int(hex[i:i+hlen/3], 16) for i in range(0, hlen, hlen/3)))
)
| true |
c78edd5344ee12806ef5282d8b4696da8840308e | rethinsilvester/AutomateExcel | /Autoexcel.py | UTF-8 | 2,690 | 2.671875 | 3 | [] | no_license | import os
import sys
import openpyxl
from openpyxl.styles import NamedStyle
wbname = sys.argv[-1]
wb = openpyxl.load_workbook(wbname)
print("Excel processing started for :", wbname)
index1 = wb["Index"]
timeser = wb["Timeseries"]
ws1 = wb.create_sheet("Sheet_A")
ws1.title = "New Timeseries"
result = wb[ws1.t... | true |
184f6daf46ea66c6c69792fa4c53a36aba956b7b | alexquesenberry/PythonGroupProject | /scores.py | UTF-8 | 1,685 | 3.171875 | 3 | [] | no_license | import sqlite3
from dbconfig import NAME_COL, SCORE_COL, HIGHSCORES_TABLE_NAME, fetchAllSQL, executeSQL
import random
import time
class Scores(object):
""" service class that offer abunch of db services
like create, remove, update, delete
"""
# user score
curr_score = 0
def __init__(self... | true |
adf12a170c85326b954bc38aaf548f39b4eb7fc5 | harshkothari410/uChat | /uchat_backend/chatapp/messageparse.py | UTF-8 | 2,555 | 3.0625 | 3 | [
"MIT"
] | permissive | from chatapp.wikidata import get_wikipedia_data
from textblob import TextBlob
from chatapp.yelpdata import get_yelp_data
from chatapp.uberdata import get_uber_data
keyword = {
'do you know': 'wiki',
'can you tell': 'wiki',
'have you any idea': 'wiki',
'can you suggest': 'yelp',
'lets go for dinner tonight': 'yel... | true |
8e0466a60a9a0ddea77d56a97608404680107682 | carlosgomes1/python-tests | /world-1/13-salary.py | UTF-8 | 269 | 4.875 | 5 | [] | no_license | # Make an algorithm that reads an employee's salary
# and shows on the screen your new salary with a 15% increase.
salary = float(input('Enter the old salary: '))
newSalary = salary * 1.15
print(f'Old salary: R${salary:.2f}')
print(f'New salary: R${newSalary:.2f}')
| true |
eea15013538d8bce0498529bc3f5f0e1d03573fe | nukacha/leetcode | /problems/106.py | UTF-8 | 712 | 3.15625 | 3 | [] | no_license | from typing import List
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
if len(inorder) == 0:
return Non... | true |
6ceb1ac3576753f2b961745a2bbc5265dd35c9fe | Abhikarki/Algorithms | /Sorting Algorithms/Heap sort/heap_sort.py | UTF-8 | 2,429 | 4.40625 | 4 | [] | no_license | # Random unsorted array.
A = [5, 4, 8, 2, 9, 5, 7, 3, 6, 8, 1]
# length of the list.
n = len(A)
def main():
print("Unsorted List: ")
for i in range(n):
# Changes the end parameter in print() from
# default value '\n' to ' '.
print(A[i], end = ' ')
# To print new line.
... | true |
fd06e14cc4381586a155a9645d30a210dd941964 | sxhcgw/sensitive | /sensitive/chi.py | UTF-8 | 5,268 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 08 15:07:19 2016
@author: ailab_guoqi
"""
#本程序为文本分类时运用CHI算法进行特征选择的实现,输入的程序应当是已经分好词的
#每一类的语料放在一个txt文件中,将所有类别的文本放在一个文件夹下
import os
import operator
#计算每一类的词频:file_root是语料集所在文件夹的地址,start_num是正文起始位置
def CalTermFreq( data_dict ):
Term_Freq_dict_list = list() #存储每一类别的词... | true |
8db607305a4161d4506eb067a0e45a8e1953cb16 | usamahn/SmartDetect | /modele_ia/app.py | UTF-8 | 837 | 2.609375 | 3 | [] | no_license | import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
import os
from sklearn.feature_extraction.text import TfidfVectorizer
app = Flask(__name__)
model = pickle.load(open('model.pkl', 'rb'))
tfidf_vectorizer = pickle.load(open('tfidf.pkl', 'rb'))
@app.route('/')
def home():
... | true |
0d73b03d3315f03a9f9f5cab4e5340c52f1cfebe | itcsoft/itcpython | /python/day24/try_0.py | UTF-8 | 390 | 3.140625 | 3 | [] | no_license | task_file = open('tasks.txt', 'r')
task_lists = task_file.readlines()
for task in task_lists:
try:
t = task.strip()
print(t, '=', eval(t))
except ZeroDivisionError:
print('На ноль делить нельзя')
except FileNotFoundError:
print('Файл не найден')
except:
print('В... | true |
f5c609544dedf3c8856140792e4d77c8bdb314a3 | usgin/validategeoportal | /geoportalvalid/logger.py | UTF-8 | 1,071 | 2.765625 | 3 | [] | no_license | import csv
from config import reportFilePath
failed_results = dict()
logWriter = csv.writer(open(reportFilePath, "wb"))
logWriter.writerow([ "DOCUUID", "XPATH", "VALUE", "MESSAGE" ])
class LogEntry():
def __init__(self, xpath, value, message):
self.xpath = xpath
self.value = value
self... | true |
49a316b6fff98a99a00118404dacf87faca75e50 | lafabo/i-love-tutorials | /thinkpython/7.5-ramanujan.py | UTF-8 | 385 | 3.015625 | 3 | [] | no_license | # https://epequeno.wordpress.com/2011/11/25/exercise-7-5/
# thanks dude!
from math import sqrt, factorial, pi
def estimate_pi():
k = 0
last = 1.0
sigma = 0
while last > 1e-15:
last = (factorial(4.0*k)*(1103.0+26390.0*(k))) \
/((factorial(k)**4.0)*(396.0**(4.0*k)))
k += 1.0
sigma += last
result = ... | true |
81cb70d305394f11adef83eeca850bf48bd01ec8 | itbc-bin/owe2a-afvinkopdracht1-Anne2GIT | /pythondebuggen.py | UTF-8 | 5,388 | 3.609375 | 4 | [] | no_license | # Naam: Anne Manders
# Datum: 4/5/6 (tel kwijtgeraakt)
# Versie: 29-10-2017
def main():
try:
try:
bestand = open("Alpacaklein.fa") # Voer hier de bestandsnaam van het juiste bestand in, of hernoem je bestand
except IOError:
print("File not found. Make sure the file is in th... | true |
e43efadbc00111654ad6893519b7d04a329c7d3d | megthehoffman/hackbright-coding-challenges | /easier/lazy-lemmings/lemmings.py | UTF-8 | 2,763 | 4.25 | 4 | [] | no_license | """Lazy lemmings.
Find the farthest any single lemming needs to travel for food.
Given a lemming in any of these holes, who has to travel the farthest?
>>> furthest(3, [0, 1, 2])
0
>>> furthest(3, [2])
2
>>> furthest(3, [0])
2
>>> furthest(6, [2, 4])
2
>>> furthest(7, [0, 6])
... | true |
59aa90a132608ef200601534a86f22e39f0c3083 | JenkinF/hexun | /hexunblog/hexunblog/dao/database_connection.py | UTF-8 | 1,056 | 2.890625 | 3 | [] | no_license | import pymysql
'''
数据库连接类
'''
class DBConnection(object):
# 连接参数
config = {
'host': '127.0.0.1',
'port': 3306,
'user': 'root',
'password': '*******',
'db': 'hexun',
'charset': 'utf8'
}
def __init__(self):
pass
# 连接数据库
@classmethod
... | true |
e2073a14025067a4feb95f9ae186b695fa6d8b29 | sinistersnare/Robson | /tests/test.py | UTF-8 | 3,322 | 3.203125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import random
import unittest
from subprocess import check_output, Popen, PIPE
from binary_tree import Tree, tree_insert, pre_order, in_order, post_order
def sort_orders(output):
"""
Takes the stdout of the default runners for the robson traversal,
and parses it into the separate l... | true |
33a82ea1d71df8f34ef2e8961ab10963c6159abe | Shaunwei/LeetCodePy | /052_n_queens_ii.py | UTF-8 | 743 | 3.4375 | 3 | [] | no_license | class Solution(object):
def totalNQueens(self, n):
"""
:type n: int
:rtype: int
"""
self.cnt = 0
self.solve(n, 0, [])
return self.cnt
def solve(self, n, row, queens):
if row == n:
self.cnt += 1
return
for col in ra... | true |
4b47a409b1ca8d8435862285d5a8f31928dadf92 | predora005/pandas-practice | /01.10minutes_to_pandas/plotting.py | UTF-8 | 1,497 | 3.515625 | 4 | [
"MIT"
] | permissive | # coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
##################################################
# メイン
##################################################
if __name__ == '__main__':
print("------------------------------------------------------------------")
pr... | true |
fbc2a51bdd5fa1ba9d434be7ded2eb9e3b10021a | benomac/network | /network/tests.py | UTF-8 | 776 | 2.625 | 3 | [] | no_license | from django.test import TestCase
from .models import User, UserPosts
# Create your tests here.
class UserPostsTest(TestCase):
def setUp(self):
# create post
User.objects.create(password="tree", username="ben")
User.objects.create(password="fence", username="dawn")
usera = User.obj... | true |
65a6ab1924233a5f56f16be72ce557fff5d4b055 | mao/python_study | /chapter08/11_magicians.py | UTF-8 | 489 | 3.96875 | 4 | [] | no_license | def show_magicians(magicians):
for magician in magicians:
print(magician)
#
def make_great(magicians):
great_magicians = []
while magicians:
great_magician = 'the Great ' + magicians.pop().lower().title()
great_magicians.append(great_magician)
while great_magicians:
ma... | true |
780e8a9f781c171687a5305b15756191e25bc0c4 | alexliberzonlab/mothpy | /mothpy/demo_thick_plume.py | UTF-8 | 3,911 | 2.875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Demonstrations of how to set up models with graphical displays produced using
matplotlib functions.
"""
from __future__ import division
__authors__ = 'Matt Graham'
__license__ = 'MIT'
import sys
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
from pompy impo... | true |
998202463be046d23b044c06eae75050f04d2f9e | sfedrick/Numerical-Approximations | /Homework2/4.26.py | UTF-8 | 1,431 | 2.71875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from odesolversystem import *
def dx(T,t):
dx=T[1]
return dx
def dx2(T,x):
a=-(x+3)/(x+1)
b=(x+3)/((x+1)**2)
f=2*(x+1)+3*b
dx2=-a*T[1]-b*T[0]+f
return dx2
def alpha(x):
return A
def Beta(x):
B=(x+3)/((x+1)**2)
return B
def Charl... | true |
a61f5a382ba05c1146a8520cc4379ad9c2ed2941 | UWPCE-PythonCert-ClassRepos/Python210_Fall2019 | /students/joejohnsto/lesson04/file_exercise.py | UTF-8 | 1,294 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
# Paths and File Processing
import os
# write print full path for all files in current directory
for _ in os.listdir():
print(os.path.abspath(_))
# Copy file from source to destination
sourcedir = os.getcwd()
#destination = sourced... | true |
e2d5294f9b577296d72a8f35b4fc96b577df449f | PinewoodPip/AwesomeSoccer | /public/Icons/Badges/recolor.py | UTF-8 | 1,284 | 3.015625 | 3 | [] | no_license | # This tool creates recolored versions of .svg files in the 'base' folder and puts them in Output/{recolor name}
# To use, create a file name 'recolor.txt' and there put the recolor name, new fill color and new stroke color, each in a new line
import os
import sys
import untangle
xml = open('recolor.xml')
config = un... | true |
d36d362d039bb2dfd77aa624b8276c895fb6d603 | rinaBorisova/GBHomework | /HW2.py | UTF-8 | 783 | 3.9375 | 4 | [] | no_license | # Пользователь вводит время в секундах.
# Переведите время в часы, минуты, секунды и выведите в формате чч:мм:сс.
# Используйте форматирование строк.
print ('Этот скрипт позволит перевести время с секунд в часы и минуты')
time = int(input('Введите число секунд целым положительным числом: '))
hour = time// 3600
min = (t... | true |
857fbdb0ae9ce24b50f5ddf3fd507190ec5b9429 | metno/gridppInNWP | /QC/updateAnDep.py | UTF-8 | 1,421 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import argparse
from obsProperties import observation,obsQuality
from db import sqlite
from firstGuessCheck import calculateDeparture
import sqlite3
def main():
parser = argparse.ArgumentParser(description='Update analysis departures')
parser.add_argument('-d','--db', dest="sq... | true |
0b9a39ab4d46453b4ef89aced9c9b3035446476c | yuryprokashev/dress-plot | /classes/entity/SimpleDress.py | UTF-8 | 345 | 2.625 | 3 | [] | no_license | from classes.interactor.PartFactory import PartFactory
class SimpleDress(object):
def __init__(self, size, config):
self.parts = []
# We first create parts separately, they do not have any x, y points
for index, part_config in enumerate(config):
self.parts.append(PartFactory.cr... | true |
42d2075c137f48fdaf3830e44e751774635f24b1 | 0523431/Python | /20200114/fibonacci.py | UTF-8 | 783 | 3.96875 | 4 | [] | no_license | '''
Created on 2020. 1. 14.
@author: GDJ19
<Fibonacci수열>
'''
def fibo(n) :
# global ..없으면 local variable 에러
# global 자료형 안 쓸거면 전역변수로 선언한 num값을 지역변수로 불러와야함
# num1 =0
# num2 =1
# num3 =num1+num2
global num1, num2, num3
fibolist.append(num1)
fibolist.append(num2)
... | true |
4735ef3a71312165f2d202802ced477f91e80cd2 | mltony/nestts | /ann_mutations.py | UTF-8 | 3,541 | 2.9375 | 3 | [
"MIT"
] | permissive |
import topology
class ANNMutation:
def is_homomorphic(self):
return False
def select_random_connection(self, topo, random):
network = topo.network
connections = [c for n in network.neurons.values() for c in n.connections]
if len(connections) == 0:
raise topolog... | true |
2615336390b45cd603a6448452fcaa6f1a0aa9f2 | DSADteam/APMwSc | /testing/prodtest.py | UTF-8 | 7,890 | 2.6875 | 3 | [] | no_license | import sys
import os
dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '../..'))
sys.path.append(dir)
from app.scrum.prod import clsProducto
from base import *
import unittest
class MdlTest(unittest.TestCase):
"""
Inicializacion de pruebas
"""
def setUp(self):
self.prod=clsPr... | true |
483330ffd2104d73bb914905c97c80f2b295a365 | lierfengmei/pyworks | /myFirstFunction.py | UTF-8 | 263 | 3.484375 | 3 | [] | no_license | import math
def my_abs(x):
if not isinstance(x,(int,float)):
raise TypeError('bad operand type')
if x>0:
return x
else:
return -x
def nop():
pass
def move(x,y,step,angle=0):
nx = x + step*math.cos(angle)
ny = y + step*math.sin(angle)
return nx,ny | true |
cc31c57fe4990ae68af3775c01814ebe63502d5b | hanming123/hanmingming | /pytest/test_demo.py | UTF-8 | 204 | 2.8125 | 3 | [] | no_license | def inc(x):
return x + 1
def test_answer():
print("这是我的第一条测试用例")
assert inc(4) == 5
def test_foo():
print("这是我的第二条测试用例")
assert inc(4) == 5 | true |
102bb9256a624f71d0ddc19dd1a1218831812d90 | motsneha/python-masterclass | /string-formating.py | UTF-8 | 520 | 4.03125 | 4 | [] | no_license | age = 15
print("My age is " + str(age) + " years.")
print("My age is {0} years.".format(age))
print("There are {0} days in {1}, {2}, and {3}".format(31, "January", "March", "May"))
print("My age is %d years." % age)
print("My age is %d %s, %d %s" % (age, "years", 6, "months"))
for i in range(1, 12):
print("No %... | true |
3561aaa6f8598378184d7ddd2a69a2c647fe7329 | sopanshewale/python-trainings | /batch-one/day-6/grouped_one.py | UTF-8 | 387 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python3
import numpy as np
import pandas as pd
df = pd.DataFrame(
{'key1' : ['a', 'a', 'b', 'b', 'a'],
'key2' : ['one', 'two', 'one', 'two', 'one'],
'data1' : np.random.randn(5),
'data2' : np.random.randn(5),
}
)
print(df)
grouped = df['data1'].groupby(df['key1... | true |
c462b305b5d9d0404296290d972f0b8d9179023d | Alexander-Serov/TASEP-analysis-drosophila | /archive/set_figure_size.py | UTF-8 | 1,144 | 2.84375 | 3 | [
"MIT"
] | permissive |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def set_figure_size(num, rows, page_width_frac, height_factor=1.0, clear=True):
pagewidth_in = 6.85
font_size = 8
dpi = 100
figsize = np.asarray([1.0, rows *
height_factor]) * page_width_frac * pagewidth... | true |
62a1b34d802c0e19cc356166db6d87f38b023366 | perdikeas/python | /programs/python_basics_1 | UTF-8 | 376 | 3.1875 | 3 | [] | no_license | message1= "ferrari"
message2="la ferrari"
message4="bugatti"
message3="supercars"
fav_car=" pagani "
print(message1.title())
print(message1.title()+" " +message2.title() + "!")
print(message3.upper()+":" +"\n"+message1+"\n"+message4)
print(fav_car.rstrip())
print(fav_car.lstrip())
print(fav_car.strip())
message5=str... | true |
6c6334d38efe94ac127991c894a80c2ff6ae0a9d | clean-code-craft-tcq-1/modular-python-pshrinidhi95 | /main.py | UTF-8 | 1,758 | 3.90625 | 4 | [
"MIT"
] | permissive |
MAJOR_COLORS = ['White', 'Red', 'Black', 'Yellow', 'Violet']
MINOR_COLORS = ["Blue", "Orange", "Green", "Brown", "Slate"]
def color_pair_to_string(major_color, minor_color):
return f'{major_color} {minor_color}'
def get_color_from_pair_number(pair_number):
zero_based_pair_number = pair_number - 1
major_index... | true |
1623fdd69807f9f782b481a7c1d4237853abafd6 | sugarshaw95/STCA_weekly_coding | /week21/187-重复的DNA序列.py | UTF-8 | 341 | 2.9375 | 3 | [] | no_license | class Solution:
def findRepeatedDnaSequences(self, s: str) -> List[str]:
seen=set()
ret=set()
l=10
n=len(s)
for b in range(n-l+1):
substr=s[b:b+l]
if substr in seen:
ret.add(substr)
else:
seen.add(substr)
... | true |
9539e8479950aef7cdd5020028f4a86b53fd0c98 | leamofy/acl-2014 | /data-from-Omars-paper/ellie-code/code/figures/ter_rank_old.py | UTF-8 | 1,372 | 2.578125 | 3 | [] | no_license | #!/bin/python
import csv
import sys
import math
import operator
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
from scipy.stats import ttest_1samp
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from matplotlib.transforms import Bbox
import textwrap
graph_data = []
seen_e... | true |
8df1c270ac8a4c473196813904f57a8600bc5727 | Mupy-tech/FlaskClassWorkOnWeb | /code.py | UTF-8 | 699 | 2.859375 | 3 | [] | no_license | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Welcome to Code Plateau; The second silicon Valley</p>"
@app.route("/home")
def home():
return "<b>Welcome</b>"
@app.route("/about us")
def aboutus():
return "<b>We are destined to making available all kinds of so... | true |
6d25a07a5a64710a35c0e34c36837a191700f3e1 | tommwq/demo | /ByLanguage/python/redisproxy.py | UTF-8 | 1,454 | 2.53125 | 3 | [] | no_license | #! /usr/bin/env python
#
# 2.7.2
#
import sys
import socket
import exceptions
def doProxy(listenPort, remoteIp, remotePort):
print listenPort, remoteIp, remotePort
try:
# connect remote peer
connectionSocket = socket.create_connection((remoteIp, remotePort))
# listen
listenSo... | true |
cfaa186c675479c37caf584c39951e80c6c5c95a | rijuSen/simpleFileTransfer | /server.py | UTF-8 | 1,053 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
import socket
s = socket.socket()
host = socket.gethostname()
port = 7777
s.bind((host,port))
s.listen(1)
print('Waiting for incoming connections...')
conn, addr = s.accept()
print(addr, "has connected to the server")
#file transfer
#sending directory list
dirList = list()
import os
fr... | true |
c734f3f1558e27493f71091b2ea133d4e82b66fc | brad2205229/python20210713_brad | /day07/OpenWeather_Demo.py | UTF-8 | 1,165 | 3.328125 | 3 | [] | no_license | import json
import requests
import datetime
key = "fe97b9427ed1fe46a19823f66c2f8c6d"
q = 'taoyuan,tw'
url = 'https://api.openweathermap.org/data/2.5/weather?q=%s&appid=%s' % (q, key)
print(url)
# description, temp, feels_like, humidity
# 1. 抓取文字資料
data = requests.get(url).text
# 2. 將文字資料轉成 json 物件(會進行結構化 dict), 目的:便於日後... | true |
e22751d4d5f9f513b0ca93d77c1ca404f6c8447e | DrBuddyO1/UT-MCC-VIRT-DATA-PT-08-2021-U-B | /Module-3_Python_Fundamentals/1/04-Ins_List/Solved/lists.py | UTF-8 | 606 | 4.40625 | 4 | [] | no_license | # Create a variable and set it as an List
myList = ["Jesse","Tarana",5]
# Adds an element onto the end of a List
myList.append("Matt")
# Returns the index of the first object with a matching value
# Changes a specified element within an List at the given index
myList[0]
# Returns the length of the List
# Remov... | true |
1fcf91b3449d16e1e5856ec1444b9037ab8328af | zaRizk7/tycoon-rpc | /game_lib/broker.py | UTF-8 | 2,054 | 3.640625 | 4 | [] | no_license | from random import randint
from pprint import pformat
from game_lib.item import Item
class Broker:
def __init__(self, name: str = ""):
self.name = name
self.cash = randint(1500, 2000)
self.inventory = dict(
Silk=Item(cost=randint(250, 300), amount=randint(3, 5)),
Si... | true |
fa5d8c63667a6aadd31290e881cca3611450cad4 | sanchezmaxar/ArtifitialIntelligenceCourse05 | /python/niche_clearing.py | UTF-8 | 1,002 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 30 09:24:59 2016
@author: stan
"""
class NicheClearing:
@staticmethod
def scale_fitness(population):
env = population.environment
sigma = population.parameters['sigma.niche.clearing']/100
kappa = population.parameters['kappa.niche.cle... | true |
c6fbc58219ed6d5e186f2608109d01403153ce44 | nicolas-schmitz/design-analysis-algorithms | /ordering/methods.py | UTF-8 | 561 | 4.40625 | 4 | [] | no_license | def insertion_sort(vector: list):
"""Sort the vector utilizign insertion sort. Loops through the vector and finishes each iteration sorting the vector to position j.
Time complexity: O(n^2)
Space complexity: O(1)
Args:
vector (list): list with values
Returns:
list: list with sorted... | true |
571775005418a8200bd58516891e43122b0092f0 | simonct/CoreAstro | /External/astrometry.net/astrometry/python/astrometry/util/multiproc.py | UTF-8 | 2,701 | 2.625 | 3 | [] | no_license | import multiprocessing
class FakeAsyncResult(object):
def __init__(self, X):
self.X = X
def wait(self, *a):
pass
def get(self, *a):
return self.X
def ready(self):
return True
def successful(self):
return True
#class PostprocessedAsyncResult(object):
# pass
class funcwrapper(object):
def __init__(self... | true |
eed472aff0fc8dbdcba3493a99f030fffbe98a8e | alekssro/CompThinkBioinf | /Week03/src/src.py | UTF-8 | 511 | 3.890625 | 4 | [] | no_license |
def linear_search(x, lst):
for y in lst:
if x == y:
return True
return False
def binary_search(x, lst):
def recurse(start, end):
# Inv: start <= end and x might be in lst[start:end].
if start == end:
return False
i = start + (end - start) // 2
if lst[i] == x:
return True
# Inv: start < end
... | true |
5c647718a26d1513b7f445a19fc2600b263eb3eb | mojingzeng/Python | /Fibonacci.py | UTF-8 | 845 | 4 | 4 | [] | no_license | #! /usr/bin/python3
def fun(n):
n1, n2 = 1, 1
count = 2
# print(type(n1))
if n < 0:
return "请输入一个正整数"
elif n == 1:
return print("1")
elif n == 2:
return print("1,1")
else:
print(n1, ",", n2, end=",")
while count < n:
res = n1 + n2
... | true |
6c787c325bcafb7cfd505646e7aa3f50fd576ac2 | DSE512/twelve | /examples/module_02_mpi/broadcast.py | UTF-8 | 447 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | """
broadcast.py
Usage:
mpirun -n <procs> python broadcast.py
"""
import numpy as np
from mpi4py import MPI
def main():
comm = MPI.COMM_WORLD
rank = comm.rank
if rank == 0:
x = np.random.randn(4)
else:
x = np.empty(4, dtype=np.float64)
print(f"Rank {rank} before broadcast has {... | true |
be14e8b27e93dead67fc3c2abebd588b60d7203c | htl1126/leetcode | /2210.py | UTF-8 | 355 | 2.875 | 3 | [] | no_license | class Solution:
def countHillValley(self, nums: List[int]) -> int:
pre, cur = 0, 1
ans = 0
for i in range(2, len(nums)):
if nums[cur] != nums[i]:
if nums[pre] > nums[cur] < nums[i] or nums[pre] < nums[cur] > nums[i]:
ans += 1
pr... | true |
b6dcb4a5945e59d96ab50a528fb2992fddd6167d | krunalmerwana/assignments | /ssh.py | UTF-8 | 1,087 | 2.78125 | 3 | [] | no_license | from paramiko import SSHClient
from paramiko import pkey
import paramiko
import sys
arg = sys.argv[1] #Taking comma separated hostnames as arguments
hostnames = arg.split(',') #Splitting with , to get Hostnames
cmd = raw_input("Enter the command : ") #Getting the command ehich would be executed
key = paramiko.RSAKey.f... | true |
855fc7c33adb63ec03634b408d2ac26c759c0221 | nidhirt/Mission-to-Mars--Web-Scraping | /scrape_mars.py | UTF-8 | 5,018 | 2.859375 | 3 | [] | no_license |
#import dependencies
from bs4 import BeautifulSoup
from splinter import Browser
import os
import pandas as pd
import time
def init_browser():
#Site Navigation
#executable_path = {'executable_path': '/usr/local/bin/chromedriver'}
#return Browser('chrome', **executable_path, headless=False)
#exec_pat... | true |
723162fba9b8938c537ce0c79cbb98d3d4fede9c | aidynkyzy/akerke | /12.py | UTF-8 | 453 | 4.0625 | 4 | [] | no_license | from math import radians, cos, sin, asin, sqrt
print("Enter the latitude and longitude of two points on the Earth in degrees:")
lt1 = float(input(" Latitude 1: "))
lt2 = float(input(" Latitude 2: "))
ln1 = float(input(" Longitude 1: "))
ln2 = float(input(" Longitude 2: "))
dln = ln2 - ln1
dlt = lt2 - lt1 ... | true |
8d4f2f2f0d02d814568b492a7ca0ba64dbf1b09b | eigenein/next-train-wear | /update-station-catalogue.py | UTF-8 | 2,085 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
import datetime
import itertools
import os
from pathlib import Path
from xml.etree import ElementTree
import click
import requests
HEADER = f'''
package me.eigenein.nexttrainwear.data
/**
* Station catalogue.
* Auto-generated on {datetime.datetime.now().replace(microsecond=0)}.
*/
object ... | true |
bf93c14ffa85fdcd49c09a6f0909bfd253b8d36d | sashakrasnov/datacamp | /28-machine-learning-for-time-series-data-in-python/4-validating-and-inspecting-time-series-models/05-cross-validation-with-shuffling.py | UTF-8 | 2,771 | 4.1875 | 4 | [] | no_license | '''
Cross-validation with shuffling
As you'll recall, cross-validation is the process of splitting your data into training and test sets multiple times. Each time you do this, you choose a different training and test set. In this exercise, you'll perform a traditional ShuffleSplit cross-validation on the company value... | true |
c82d02b29c368a5b9f02eb23b597974a9cfb38ae | dojowahi/livy_spark | /utility/SparkLivy.py | UTF-8 | 7,903 | 3.03125 | 3 | [] | no_license | import requests
import logging
from random import randint
import json
import time
class SparkLivySql:
__livy_url = None
__headers = None
__livy_session = None
def __init__(self, livy_url, ):
self.__livy_url = livy_url
self.__headers = {'Content-Type': 'application/json'}
def ge... | true |
45a2391208479377da702709c12887e6a55814e0 | zf522/Python_py | /demo/汇率计算/demo02.py | UTF-8 | 249 | 3.15625 | 3 | [] | no_license | """
by:张飞
date:2.25
title:汇率计算
"""
rmb_str_value = input("人民币的金额是:")
rmb_value = eval(rmb_str_value)
usd_vs_rmb = 6.67
usd_value = rmb_value*usd_vs_rmb
print("对应的美元金额是:",usd_value) #加上rmb_value??? | true |
6d9af0cac099f4fc9c2087fdbd3223fa4805e5d2 | SefaAkdeniz/Hackerrank-Problems-Solutions-for-Python | /Birthday Cake Candles/birthdayCakeCandles.py | UTF-8 | 620 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 19 15:00:41 2020
@author: sefa
"""
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the birthdayCakeCandles function below.
def birthdayCakeCandles(ar):
maxHeight=max(ar)
response=0
for each in ar:
if each == maxH... | true |
2c7dca0b5b89bd39715f69b73845c063cf437c1f | kchalabi/Hackerrank-Python | /Basic_Data_Types/Lists.py | UTF-8 | 810 | 3.296875 | 3 | [] | no_license | if __name__ == '__main__':
N = int(input())
StateList = []
Statement = []
Data = []
for i in range(N):
Statement = str(input()).split()
StateList.append(Statement)
for i in range(N):
if(StateList[i][0] == "insert"):
Data.insert(int(StateL... | true |
3dbcdfb679e1bd333ea7cd020dfc4f44fe4ec82a | LiuFang816/SALSTM_py_data | /python/rwth-i6_returnn/returnn-master/StereoDataset.py | UTF-8 | 13,279 | 2.765625 | 3 | [] | no_license | # This file contains dataset implementations to have an easy to use
# interface for using RETURNN for regression.
# Applications are for example speech enhancement or mask estimations
__author__ = 'menne'
import os
import numpy as np
import h5py
from collections import deque
from CachedDataset2 import CachedDataset2
... | true |
4b68275dbb943652379ef45a18e00d10d6b5808a | grassriver/Zhidao | /Portfolio_Optimization/FM_OPT.py | UTF-8 | 2,629 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 12 20:21:56 2018
@author: Kai Zheng
"""
import numpy as np
import pandas as pd
import sqlite3 as sql
import sys
sys.path.append('..')
import Portfolio_Optimization.mv as mv
import Portfolio_Optimization.rolling as rolling
import general_tools as tool
from portfolio_class... | true |
fc16a38ea4e1408558472647a5b7e7ae83fe49fb | VaibhavD143/Coding | /Comapnies/scaler_b.py | UTF-8 | 808 | 2.921875 | 3 | [] | no_license | def solve(A, B):
left = [-1]*len(A)
right = left[:]
ha={}
sm = 0
cur = -1
for i in range(len(A)):
if A[i] == '1':
cur = i
ha[i] = sm
else:
sm+=1
left[i] = cur
cur = -1
for i in range(len(A)-1,-1,-1):
if A[i] == '1':
... | true |
695d147dc54c20e627b0c1a6973abbd5513dde63 | Alli-B/Python-task | /TASK3.py | UTF-8 | 1,134 | 4.28125 | 4 | [] | no_license | import random
def gameSystem(limit, count):
number = random.randint(1, count)
chances = limit
for x in range(limit):
guess = int(input())
chances -= 1
if guess == number:
print("Congratulation YOU WON!!!")
break
... | true |
ea98bb46cae4f3993236cf29aec5ba40147a0436 | 8059542577066/Heap-Sort-Merge-Sort-and-Binary-Search | /Heap Sort.py | UTF-8 | 2,472 | 3.453125 | 3 | [
"Unlicense"
] | permissive | import random
def swap(array, i1, i2):
temp = array[i1]
array[i1] = array[i2]
array[i2] = temp
def heapify(array):
for i in xrange(1, len(array)):
c = i
while c > 0:
if c % 2 == 1:
p = c / 2
else:
p = c / 2 - 1
... | true |
c9413ed07d66e207d80eb3cbe248aee867d8db45 | NomsoIroha23/Asgard | /28th of march.py | UTF-8 | 4,042 | 3.859375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
a=1
# In[2]:
b=2
# In[3]:
c = a + b
# In[5]:
print (c)
# In[6]:
type(c)
# In[7]:
name = "francis"
# In[8]:
type (name)
# In[9]:
fname = 1
sname = "okoye"
# In[10]:
a = "2"
b = 3
# In[12]:
int (a) + b
# In[13]:
a = 1
b = 2
c = 3
t... | true |
9c30d9780f268909c3ee6abda56c5334e86df55d | uniqueyehu/snippet | /python/learnpy/testio.py | UTF-8 | 411 | 3.640625 | 4 | [] | no_license | # output
print('Hello, world!')
print('this', 'is', 'test', 'string')
print('300 + 100 =', 300 + 100)
# input
name = input('enter your name: ')
print('hello', name)
# 格式化输出
strr = 'hhh'
num = 25
print('your name is %s' % strr)
print('the number is %d' % num)
# 查看版本
import platform
print(platform.pyt... | true |
dd475fc8ff500f91d402f75421cb2531c1325086 | conbitin/python-autotask | /lib_downloader.py | UTF-8 | 1,017 | 2.78125 | 3 | [] | no_license | import requests
import sys
from bs4 import BeautifulSoup
import os
url = 'http://10.252.250.53:8081/lm/content/groups/public/'
url2 = 'https://repo.maven.apache.org/maven2/'
command_prefix = 'wget --recursive --directory-prefix="D:/repo/" --level 0 --no-parent http://10.252.250.53:8081/lm/content/groups/public/'
def ... | true |
5f589b2894cbd833cb7e489d3280c275caa54a20 | Opeyemi19/ours_tutos | /Tuto_Python3/11_chaine_carateres/main.py | UTF-8 | 2,281 | 4.40625 | 4 | [] | no_license |
"""
Une methode de chaine de caractere travaille sur des copie, et pas sur la chaine elle-même
str.upper(), str.lower(), str.capitalize(), str.title()
str.center(<largeur>, <caractere_remplissage>)
str.strip()
str.split()
str.find(<chaine>, <debut>, <fin>)
str.index(<chaine>, <debut>, <fin>)
str.replace(<ancienne>,... | true |
918010e95c29c4891d8d49a13a2b42f4c7b616ce | yushuang823/python-learn | /demo2/lianxi.py | UTF-8 | 403 | 3.578125 | 4 | [] | no_license | class Person(object):
x = 1
class Name1(Person):
pass
class Name2(Person):
pass
Name1.x = 2
print(Name1.x)
Name2.x = 3
print(Name2.x)
Person.x = 4
print(Person.x)
if __name__ == '__main__':
s = {'a', 'b'}
print(type(s))
print('i\'m ok')
d = {'a': 1, 'b': 2, 'c': 3, 'd': 4}
print(d... | true |
3615a377ac7969f112f8092fb81f24c5f91c33a6 | yongseongCho/python_201911 | /day_17/matplotlib_08.py | UTF-8 | 440 | 3.578125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
from matplotlib import pyplot as plt
x1 = list(range(1, 101))
y1 = list(map(lambda x : x * 1.2, x1))
x2 = list(range(1, 101))
y2 = list(map(lambda x : x * 1.7, x2))
plt.title('matplotlib example')
plt.xlabel('x label')
plt.ylabel('y label')
# 다수개의 라인을 하나의 차트에 표현할
# 수 있음
plt.... | true |