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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a6f6dfef4c69f5f586552de7f3e451fa65c2609d | Python | EastupGame/python_basic | /0809/list05.py | UTF-8 | 417 | 3.390625 | 3 | [] | no_license | QUESTION = ["한세사이버보안고가 있는 구는?",
"한세사이버보안고에서 가장 가까운 지하철 역은",
"한세사이버보안고의 교화는?"]
R_ANS = ["마포구","애오개역","매화"]
for i in range(3):
print(QUESTION[i])
ans = input()
if ans == R_ANS[i]:
print("정답입니다.")
else:
print("오답입니다.")
| true |
b8ffb8ed38ea626b212390fd364d0122c2806564 | Python | bfieldtools/bfieldtools | /examples/validation/one_element.py | UTF-8 | 3,319 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | """
One-element fields
======================
"""
import numpy as np
from bfieldtools.mesh_magnetics import (
scalar_potential_coupling,
vector_potential_coupling,
)
from bfieldtools.mesh_magnetics import (
magnetic_field_coupling,
magnetic_field_coupling_analytic,
)
import trimesh
from mayavi impo... | true |
589fd67fe1dbba5b4637b0c4cdc6bd92c920d2a5 | Python | juanvallejo/notes | /cs428/xor_example.py | UTF-8 | 188 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
def encrypt(plaintext, key):
enc_strNums = ""
for i in plaintext:
enc_strNums += chr((ord(i) ^ key))
return enc_strNums
print encrypt(encrypt("test", 2), 3)
| true |
9c8e5ac2fa7e0d2612375f2287645e2fc9db04da | Python | roger6blog/LeetCode | /SourceCode/Python/Problem/00294.[Locked]Flip Game II.py | UTF-8 | 2,670 | 4.59375 | 5 | [] | no_license | '''
Level: Easy Tag: [Back Tracking]
You are playing the following Flip Game with your friend:
Given a string that contains only these two characters: + and -, you and your friend take turns to flip two consecutive "++" into "--".
The game ends when a person can no longer make a move and therefore the other person ... | true |
f3b0a7e6f66e750a26f61ee39dd1f6958679956c | Python | CamronAlexanderHirst/poly_planner | /main.py | UTF-8 | 4,192 | 2.921875 | 3 | [] | no_license | """
Planning in Polygons!
Author: Alex Hirst
"""
from src.RRT_util import *
from src.polygon_util import *
from shapely.geometry import Point, Polygon
import math
import time
import matplotlib.pyplot as plt
# Environment Parameters (m)
xBounds = [-200, 600]
yBounds = [-300, 300]
region = Polygon([(xBounds[0], yBound... | true |
791c0b80abb93737c5ecf4e64d413a4052574978 | Python | cuoca99/signate-studentcup2019 | /predict/predict.py | UTF-8 | 5,535 | 2.875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import warnings
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import mean_squared_error
from pprint import pprint
from pathlib import Path
from tqdm import tqdm
def rmse(pred, target):
... | true |
cc267a2ce2d5db27ebc1e67e00cf86899fe6624f | Python | MHuiG/CTF-learn | /Cryptography tools/code/Manchester/Manchester.py | UTF-8 | 366 | 2.671875 | 3 | [
"MIT"
] | permissive | n=0x123654AAA678876303555111AAA77611A321#二进制
flag=''
bs='0'+bin(n)[2:]
r=''
def conv(s):
return hex(int(s,2))[2:]
for i in range(0,len(bs),2):
if bs[i:i+2]=='01':
r+='0'
else:
r+='1'
print (r)
for i in range(0,len(r),8):
tmp=r[i:i+8][::-1]
flag+=conv(tmp[:4])
fla... | true |
a0ca7c4c726c9995ba02050d00e5923e9db861e1 | Python | tarun-batra-guavus/qa | /ciTool/Potluck_cloudera/Testcases/solution/Platform/check_hbase-master_process.py | UTF-8 | 1,165 | 2.640625 | 3 | [] | no_license | """
Purpose
=======
Check that Hbase version on its respective Nodes are as User Specified
Test Steps
==========
1. Goto to shell
2. Execute "rpm -qa | grep -i "componentName" | grep "version"" and check that hive version on all hive machines are as User Specified
"""
from potluck.nodes import connect, get... | true |
e5646af3c21733857cec2ac7dc4c6226665788bc | Python | DomWeldon/bindicator | /tests/bindicator/test_bins.py | UTF-8 | 530 | 2.71875 | 3 | [] | no_license | import datetime
def test__query_next_date_for_each_bin():
# arrange
from bindicator import bins
# act
next_dates = bins._query_next_date_for_each_bin()
# assert
assert len(next_dates) == 4
def test__get_next_bin_day():
# arrange
from bindicator import bins
from bindicator.confi... | true |
10bb76f8da8741c897570ae61f63b632fd828b40 | Python | syed-saif/bing-o | /myapp.py | UTF-8 | 14,420 | 2.703125 | 3 | [] | no_license | import eventlet
eventlet.monkey_patch()
from flask import Flask, render_template, request, redirect, url_for
from flask_socketio import SocketIO, emit, join_room, leave_room
import random
import os
import numpy as np
import orjson
import redis
r = redis.from_url(os.environ.get('REDIS_URL') , charset='utf-8',decode_re... | true |
e7fe7936b02a94cae4d403ac27bcfbd205a2d163 | Python | mocanu-alexandru-ubb/Book-Library | /class_UI.py | UTF-8 | 8,596 | 2.9375 | 3 | [] | no_license | from Entities.class_CustomError import CustomError
from Services.class_BookService import BookService
from Services.class_ClientService import ClientService
from Services.class_RentalService import RentalService
class UI(object):
def __init__(self, book_service, client_service, rental_service, un... | true |
9e188d3bb419a241f3af8da31c54ec1029ca67f4 | Python | architecture-building-systems/ASF_Simulation | /Simulation_Tool/New_SimulationEnvironment/python/prepareData_mauro.py | UTF-8 | 15,616 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 31 16:47:05 2016
functions to import and prepare data for post processing
@author: Jeremias
"""
import numpy as np
import sys, os
import json
from calculate_angles_function import create_ASF_angles
from auxFunctions import unique, calcDaysPassedMonth, calculate_sum_f... | true |
e570e11ec9f3a165c34e2c923cfdc7cd1be792c8 | Python | Hyperdraw/FridayClub | /games/trivia.py | UTF-8 | 1,226 | 3.328125 | 3 | [] | no_license | import urllib.request
import json
import random
counter = 1
points = 0
while True:
print("You have",points,"points")
triviaurl = 'https://opentdb.com/api.php?amount=1&difficulty=easy&type=multiple'
response = urllib.request.urlopen(triviaurl)
result = json.loads(response.read())
#print(result)
... | true |
72c1481a76744bb8d5d0f327f6ecb78b4449da35 | Python | corey-smith1/Pracs | /Prac 2/askName.py | UTF-8 | 87 | 3.234375 | 3 | [] | no_license | name = input('Please enter your name')
f = open("name.txt",'w')
f.write(name)
f.close() | true |
30a65b20e78624b78f245973dc8e68f95f199416 | Python | erickmiller/AutomatousSourceCode | /AutonomousSourceCode/data/raw/sort/66937ab9-7270-4bef-99c0-1fe77d6613a7__sort.py | UTF-8 | 1,876 | 2.90625 | 3 | [] | no_license | #! /usr/bin/python
import random
import time
import numpy
import sys
import quickSort
import selectionSort
import bubbleSort
import optBubbleSort
import insertionSort
import inplaceQuickSort
import utils
import heapSort
import inplaceSimpleQuickSort
import inplaceMidPivotQuickSort
def measureInline(sortObj):
inputAr... | true |
ca5bdaa76fe8106fdbb0ea045fc3de24a24e61a1 | Python | xdhchen/DataStructure_KG | /mysql_db/data_show.py | UTF-8 | 1,077 | 2.53125 | 3 | [] | no_license | import pymysql
import os
"""
将csv文件数据保存到数据库
"""
def cate_rel_show(sql):
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='root', db='study_kg') # db:表示数据库名称
cursor = conn.cursor()
cursor.execute(sql)
sql_data = cursor.fetchall()
sql_data = list(sql_data)
data = [] # ... | true |
18e0be482de7d7328ecda70f44f0584b61e92c2f | Python | dhw614714/python | /出租计费.py | UTF-8 | 304 | 3.4375 | 3 | [] | no_license | a=1
c=0
while a ==1:
b=int(input())
if b==0:
print(" 请输入正确的公里数进行计算")
elif b>0 and b<=2:
print(8)
elif b>2 and b<=12:
c=8+1.2*(b-2)
print(c)
elif b>12:
c=20+1.5*(b-12)
print(c)
| true |
b361398b9391168432c6f355590e0f85b557c762 | Python | Piyush1Kumar/Week5 | /genPrimes.py | UTF-8 | 385 | 3.28125 | 3 | [] | no_license | def genPrimes():
""" generator that returns sequence of prime numbers """
primes = [] # primes generated so far
guess = 1 # next guess number tried
while True:
guess += 1
for p in primes:
if guess % p == 0:
break
else:... | true |
b9e832fb3704b152769ed5b4d21b0f9b66f9cf7f | Python | 2legit/python-anandology | /working-with-data/20.py | UTF-8 | 432 | 3.65625 | 4 | [] | no_license | """ Implement unix command grep. The grep command takes a string and a file as
arguments and prints all lines in the file which contain the specified string. """
def grep(linelist,string):
for i in linelist:
if string in i:
print i
import sys
if len(sys.argv)!=3:
print '\terror : specify a filename and/or a s... | true |
cf474e60919d8bddf250c18ed35ae69ce5bb6477 | Python | nar0se/NCI | /Database-Python/user.py | UTF-8 | 688 | 3.015625 | 3 | [] | no_license | class User:
def __init__(self, firstName = None, lastName = None, age = None, phone = None):
self.firstName = firstName
self.lastName = lastName
self.age = age
self.phone = phone
def setFirstName(self, firstName):
self.firstName = firstName
def getFirstName(self... | true |
b78e5c74ffccffafb585e4f58f550ef2b851b13b | Python | leabr1/python | /olimpiada/ex3.py | UTF-8 | 222 | 3.484375 | 3 | [] | no_license | n_casos=int(input())
con_in=0
con_out=0
for caso in range(n_casos):
x=int(input())
if x>=10 and x<=20:
con_in=con_in+1
else:
con_out=con_out+1
print("%d in" %(con_in))
print("%d out" %(con_out)) | true |
ad424fdb9fa4f2b185e95f12e63acb89955a0cdb | Python | nyzplymh/stuScrapy | /com/getblog/BDDK.py | UTF-8 | 830 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/8/4 9:14
# @Author : Aries
# @Site :
# @File : BDDK.py
# @Software: PyCharm
import string ,urllib2
def baidu_tieba(url , start_page ,end_page):
for i in range(start_page ,end_page):
sName = string.zfill(i,5)+".html"
... | true |
49b7cf397a125175acd4fb8afbaaa4ecafd81562 | Python | ryandelongchamps/CSV | /sitka4.py | UTF-8 | 1,349 | 3.390625 | 3 | [] | no_license | import csv
import matplotlib.pyplot as plt
from datetime import datetime
infile = open("death_valley_2018_simple.csv", "r")
csvfile = csv.reader(infile, delimeter = ",")
header_row = next(csvfile)
for index, column_header in enumerate(header_row):
print(index,column_header)
mydate = datetime.strptime("2018-07-... | true |
aa072e1a0ecdb638aa54e42109f3e129b2d5c592 | Python | andarms/Rotation-Thruster-Movement | /aster.py | UTF-8 | 1,485 | 3.125 | 3 | [] | no_license | import itertools
import pygame as pg
import prepare
class Loop(object):
def __init__(self, sheet, size, fps, rows, columns, missing=0):
self.delay = 1.0/fps
self.accumulator = 0.0
self.frames = self.make_cycle(sheet, size, rows, columns, missing)
self.frame = None
self.get_n... | true |
0987ea7d08f88e63bb308d5de4dc5ee4a893f426 | Python | Leo-fse/back-end | /api/database/serialize.py | UTF-8 | 199 | 2.6875 | 3 | [] | no_license | def serializeDict(a) -> dict:
return {**{i:str(a[i]) for i in a if i=='_id'}, **{i:a[i] for i in a if i!='_id'}}
def serializeList(entity) -> list:
return [serializeDict(a) for a in entity] | true |
c4184a3a8ca907c63b30c0fa0357c02895d00322 | Python | a6361117/code | /Day31-Day45/Day45/pile.py | UTF-8 | 1,204 | 3.96875 | 4 | [] | no_license | #堆合、堆和双端队列
#集合,是由模块sets中的Set类实现的。
print(set(range(10))) #在不提供任何参数的情况下调用set。
print(type({})) #花括号来创建空集合,因为这将创建一个空字典
print({0, 1, 2, 3, 0, 1, 2, 3, 4, 5}) #集合中元素的排列顺序是不确定的
print({'fee', 'fie', 'foe'})
a = {1, 2, 3}
b = {2, 3, 4}
print(a.union(b))
print(a | b)
c = a & b
print(c.issubset(a))
print(c <= a)
p... | true |
2cd04888e9eb4bb63f401bd6f707c1aa60b3afb9 | Python | DMTF/Redfish-Usecase-Checkers | /account_management/account_management.py | UTF-8 | 8,893 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright Notice:
# Copyright 2017-2019 Distributed Management Task Force, Inc. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Usecase-Checkers/blob/main/LICENSE.md
"""
Account Management Usecase Test
File : account_management.py
Brief : This file cont... | true |
dbccc0e9001b3c6d1aede4195834e8ed8ee00eba | Python | gwyxjtu/Deep_Q_Learning | /Deep_Q_Learning_by_ljs/frame_process.py | UTF-8 | 493 | 2.515625 | 3 | [] | no_license | import numpy as np
import cv2
class FrameProcess:
def __init__(self, frame_height=84, frame_width=84):
self.frame_height = frame_height
self.frame_width = frame_width
def process(self, frame):
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
frame = cv2.resize(
... | true |
df4daef84fa8e3f0ea5bebb1c6106d6e45d2cf05 | Python | Aasthaengg/IBMdataset | /Python_codes/p03425/s522832420.py | UTF-8 | 667 | 2.671875 | 3 | [] | no_license | n = int(input())
s = [input() for _ in range(n)]
march = {'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0}
for name in s:
if name[0] in march.keys():
march[name[0]] += 1
#(m,a,r)(m,a,c)(m,a,h)
#(m,r,c)(m,r,h)
#(m,c,h)
ans = march['M']*march['A']*march['R']
ans += march['M']*march['A']*march['C']
ans += march['M']*m... | true |
f234b63052f2e7530a292c289577395f2660c1c1 | Python | korabl/python_lessons | /lesson_1/task5.py | UTF-8 | 559 | 3.78125 | 4 | [] | no_license | revenue = int(input('Введите выручку (т.р.): '))
cogs = int(input('Введите издержки (т.р.): '))
profit = revenue - cogs
if profit < 0:
print('Убыток')
elif profit == 0:
print('Вы работаете в ноль')
else:
print('Прибыль')
rent = revenue/cogs
print(f'Рентабельность: {rent}')
employers = int(input(... | true |
4e029c94b59a793f98f9415f3a3f66397fc9dbb3 | Python | GZHermit/pointnet3 | /train_tensorbody.py | UTF-8 | 2,862 | 2.65625 | 3 | [] | no_license | import argparse
from pointnet import PointNetCls, PointNetSeg
from pointnet2 import PointNet2SemSeg, PointNet2PartSeg
from datasets import ModelNetDataset, TensorBodyDataset
import torch
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
... | true |
4d4604ec6efa417c3220e5f3dbf4b0a59da74657 | Python | DimitarRadkovDimitrov/aws-azure-lambda-file-copy | /pythonLambdaFunction.py | UTF-8 | 1,033 | 2.5625 | 3 | [] | no_license | import json, boto3
def lambda_handler(event, context):
s3_client = boto3.client('s3')
s3 = event['Records'][0]['s3']
bucket_name = s3['bucket']['name']
object_key = s3['object']['key']
copy_bucket_name = create_bucket_copy_if_not_exists(s3_client, bucket_name)
copy_bucket = boto3.res... | true |
15f8221acf93ff827b1b2190b8507a078bc794a3 | Python | c0mput3rxz/bitterwoods | /modules/overmap.py | UTF-8 | 10,101 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | from mud.module import Module
from mud.inject import inject
from mud.collection import Collection, Entity, FileStorage
class Overmap(Collection):
ENTITY_CLASS = Entity
STORAGE_CLASS = FileStorage
@inject("Overmap", "Areas")
def overmaps_command(self, Areas, *args, **kwargs):
# TO_DO Table-fy this.
co... | true |
4183e4a92e9764c7a15cc274358cd57bd1495b25 | Python | VitamintK/AlgorithmProblems | /leetcode/c207/b.py | UTF-8 | 509 | 3.015625 | 3 | [] | no_license |
class Solution:
def maxUniqueSplit(self, s: str) -> int:
def find(s, start, end):
if start == end:
return [set()]
# best = 0
# argbest = None
ans = []
for last_char in range(start, end):
x = find(s,last_char+1,... | true |
684505228d861f1413265c80abd2ba102c4c419e | Python | hartmannw/utilities | /string_manipulation/string_manip.py | UTF-8 | 2,002 | 3.078125 | 3 | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/python
#
# William Hartmann (hartmannw@gmail.com)
# This is free and unencumbered software released into the public domain.
# See the UNLICENSE file for more information.
#
# Contains various string manipulation functions.
import operator
# Computes both the edit distance between the two strings, but also ... | true |
9157f0310d0f3f3f5756d64c73da4942badff187 | Python | adrianmfi/ProjectEuler | /python/P50.py | UTF-8 | 537 | 2.71875 | 3 | [] | no_license | from P37 import primesSieve
def p49():
primes = primesSieve(1000000)
maxIters = 0
for i in range(len(primes)):
primtallet = primes[i]
for n in range(i):
pSum = 0
counter = n
while pSum <= primtallet:
pSum += primes[counter]
... | true |
d4c4f7c41a7ea3736150edf3b09436463998364c | Python | MaxVanDijck/pytorch-library | /models/cnn/alexnet.py | UTF-8 | 2,615 | 2.5625 | 3 | [
"MIT"
] | permissive | '''AlexNet model for PyTorch
[ImageNet Classification with Deep Convolutional Neural Networks](https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf)
'''
import torch
import torch.nn as nn
class Alexnet(nn.Module):
def __init__(self, img_channels, num_classes, dropout=0.5):
... | true |
08e6e3b4492b24cff3fbd9436bc6a61bc615f472 | Python | bkulenko/django_num2words | /translator/translate.py | UTF-8 | 2,491 | 3.109375 | 3 | [] | no_license | numdict = {0: '', 1: 'jeden ', 2: 'dwa ', 3: 'trzy ', 4: 'cztery ', 5: 'pięć ', 6: 'sześć ', 7: 'siedem ', 8: 'osiem ', 9: 'dziewięć ', 10: 'dziesięć ',
11: 'jedenaście ', 12: 'dwanaście ', 13: 'trzynaście ', 14: 'czternaście ', 15: 'piętnaście ', 16: 'szesnaście ', 17: 'siedemnaście ',
18: 'osiem... | true |
2adcfc5079c11d6787b66a01bb38bc4c270d8cd4 | Python | ruchir594/ard | /pyrig/baudcalc.py | UTF-8 | 275 | 2.921875 | 3 | [] | no_license | import serial
ser = serial.Serial('/dev/cu.usbmodemM4321001', 9600)
import time
timeout = time.time() + 5 # 5 second from now
buff = []
while True:
buff.append(ser.readline())
if time.time() > timeout:
break
for e in buff:
print e
print len(buff)
| true |
0e84f6801322796f8d55ae3a3e1585c43e021465 | Python | freichmann/bluetoothcube | /bluetoothcube/cubedisplay.py | UTF-8 | 3,753 | 2.765625 | 3 | [] | no_license | import kivy
from kivy.app import App
from kivy.vector import Vector
from kivy.uix.widget import Widget
from kivy.clock import Clock
from kivy.graphics.vertex_instructions import Rectangle
from kivy.graphics.context_instructions import Color
from kociemba.pykociemba.facecube import FaceCube
STICKERS = {
'green'... | true |
1e89d252235e42e4b9018a2617a64aa576d5365e | Python | mukund-kri/python-utils-refrence | /archive/utils/commandline/argparse/positional.py | UTF-8 | 794 | 3.28125 | 3 | [] | no_license | '''
Python's standard lib includes the argparse lib which makes it easy to write
scripts that intreacts with the user. This example is ripped out of one of my
backup script.
'''
from argparse import ArgumentParser
def backup():
''' run backup here '''
print('backing up your files')
def restore():
''' r... | true |
b3fd9094bff78e26bbc066290926e6cabdc111dc | Python | th10043436/soft_th | /web_soft/common/config_ccc.py | UTF-8 | 469 | 2.84375 | 3 | [] | no_license | import configparser
class Conig_c(object):
# 类实例化
def __init__(self,path):
self.config =configparser.ConfigParser()
#读取文件
self.config.read(path)
def key_value(self,session):
#解析config_emalil 数据
list=[]
list=self.config.items(session)
return list
if ... | true |
278558e4da38e590fc713d97511d9404ad4352e3 | Python | NNTin/Reply-Dota-2-Reddit | /odotaapi/getodmatchdetails.py | UTF-8 | 1,525 | 2.59375 | 3 | [
"MIT"
] | permissive | import requests
import time
#from reddit.botinfo import message
message = False
def getODMatchDetails(matchID, q=None):
try:
response = {}
attempt = 0
while response == {}:
if message: print('[getodmatchdetails] get match details on OpenDota')
URL = 'https://api.... | true |
1785fb17a58bfb93d1390ca4010b88630f7b3965 | Python | MachineLearning-Tutorials/wikigrammar | /wikigrammar/functions.py | UTF-8 | 663 | 2.890625 | 3 | [] | no_license | import mwparserfromhell as mwparser
from mwparserfromhell.nodes import Heading, Wikilink
def clean_wikitext(sentence_text):
wikicode = mwparser.parse(sentence_text.strip())
stripped_text = strip_wikicode(wikicode)
return stripped_text.replace("\t", "\\t").replace("\n", "\\n")
def strip_wikicode(wikicode... | true |
1287f04d31a3a7e0ec3571f51c79b3496e2e87ff | Python | YiseBoge/CompetitiveProgramming | /LeetCode/__Contest__/Day10/race_car.py | UTF-8 | 878 | 3.234375 | 3 | [] | no_license | import collections
class Solution:
def racecar(self, target: int) -> int:
start = (0, 1)
steps = {start: 0}
queue = collections.deque([start])
while queue:
current = queue.popleft()
position = current[0]
speed = current[1]
if positio... | true |
97eb411438e2ddf44be92c6d4f21ee5b7a729344 | Python | sloan-dog/basics | /python/build_bst.py | UTF-8 | 667 | 4.03125 | 4 | [] | no_license | from collections import deque
class Node(object):
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
def sorted_list_to_bst(arr, start, end):
if start > end:
return None
mid = int( (start + end) / 2 )
n = Node(arr[mid])
n.left = sorted_list_to_bst(arr, sta... | true |
52cc728f96a54c8b4305cb2d1fd4fba9ab44fd78 | Python | ShrohanMohapatra/LaunchpadACT | /factorial2.py | UTF-8 | 3,016 | 3.28125 | 3 | [] | no_license | # Debugged using factorial1.py
from random import randint
from time import time
from sys import setrecursionlimit
def digits(num):
s,d = num,[]
while s>0:
d.append(s%10)
s = int(s/10)
d.reverse()
return d
def numberFromDigits(arr):
s = 0
for k in range(len(arr)): s = 10*s + arr[... | true |
3a61e50f5d1e545d651b453357ff16ec30ecb5ef | Python | jaguuuar/learning_materials | /school/teacher.py | UTF-8 | 372 | 3.359375 | 3 | [] | no_license |
class Teacher:
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
self.subjects = []
def get_full_name(self):
full_address = '{} {}'.format(self.first_name, self.last_name)
return full_address
def __eq__(self, oth... | true |
85ed82483590c1166fc02f9081d7ea9ab9ccfceb | Python | paik11012/TIL | /StartCamp/02_DAY/csv_handling/csv_write.py | UTF-8 | 895 | 3.796875 | 4 | [] | no_license | dinner = {
'양자강': '02-557-4211', #차돌짬뽕
'김밥카페': '02-553-3181', #라돈
'순남시래기': '02-508-0887' #보쌈정식
}
#make dictionary as for
#print (dinner.keys) -> lists
#print (dinner.values) ->numners
#print(dinner.items()) ->bring both keys and values
# print (dinner.items())
#1. string formatting - make... | true |
464ef1674ee02f54420dc877c35ac5ea9db0e806 | Python | SelmTalha/sinav_calisma | /VizeÇalışma(python)/Örnekler/ucgeninalani.py | UTF-8 | 124 | 3.109375 | 3 | [] | no_license | a=int(input("Tabanı giriniz:"))
b=int(input("Yüksekliği giriniz:"))
def alanbulma():
return a*b/2
print(alanbulma()) | true |
33c1d4d089481411b0686779c02a63f1e34b226a | Python | moongchi98/MLP | /백준/JAN_FEB/2447.py | UTF-8 | 401 | 3.234375 | 3 | [] | no_license | # k = int(input())
# N = 3**k
def star_func(N):
result =[]
if N == 3:
block=("*"*3+"\n"+"* *"+"\n"+"*"*3+"\n")
return block
if N > 3:
N = N // 3
square = (" "*N+"\n")*N
for j in range(3):
result.append(star_func(N))
for i in range (len(result)):
... | true |
b6d7ed9dd27e6b3a4e2f416af46de7f38368ddd1 | Python | sunday2146/notes-python | /Python基础笔记/12-tkinter图形界面/11Listbox控件中.py | UTF-8 | 972 | 3.71875 | 4 | [] | no_license | import tkinter
#创建主窗口
win = tkinter.Tk()
#设置标题
win.title("sunck")
#设置大小和位置
win.geometry("400x400+200+200")
#绑定变量
lbv = tkinter.StringVar()
#1.创建一个listbox,添加几个元素
#SINGLE与BORWSE 相似,但是不支持鼠标按下后移动选中位置
#1.创建一个listbox,添加几个元素
lb = tkinter.Listbox(win,selectmode = tkinter.SINGLE,listvariable = lbv)
lb.pack()
for item in ["go... | true |
174d4113dbc9b986bb902284e8ef17406733b520 | Python | Seabra14/pythonProject | /2/36.py | UTF-8 | 460 | 3.671875 | 4 | [] | no_license | casa = float(input("Valor da casa :€"))
salário =float(input("Salário do comprador:€"))
anos= int(input("Quantos anos de financiamento?"))
prestação= casa / (anos * 12)
mínimo = salário * 30 / 100
print ("Para pagar uma casa de €{:.2f} em {} anos".format(casa,anos), end="")
print(" a prestação será de €{:.2f}".format(p... | true |
57a37f1be6ff81d0de3a67915adbfa795d3d8d84 | Python | rkhood/dress_clusters | /cnn.py | UTF-8 | 4,320 | 2.6875 | 3 | [] | no_license | import glob
import os
import json
import numpy as np
import pandas as pd
from keras.preprocessing.image import ImageDataGenerator
from keras import models
from keras import layers
from keras import optimizers
from keras.utils import to_categorical
from keras import regularizers
from keras.applications import VGG16
from... | true |
72e55199cba6043d707e4622527b745a5cfda2f8 | Python | m-elhussieny/code | /maps/build/Traits/examples/demo/Dynamic_Forms/dynamic_selector.py | UTF-8 | 2,786 | 3.609375 | 4 | [] | no_license | # Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
"""
Demo to redefine legal values of one attribute based on another via GUI.
Code sample showing a simple implementation of the dynamic
redefining of a trait attribute's legal values on the basis of another
trait attribute's assigned value.
Demo class "... | true |
4a1b676983db560a683e8b7efb853b79def3901b | Python | Mallaguetti/Curso-em-video | /cursoDePython/ex004.py | UTF-8 | 312 | 4.34375 | 4 | [] | no_license | x = input("Digite algo: ")
print("O valor digitado é: ")
print("Tipo: {}".format(type(x)))
print("Numerico: {}".format(x.isnumeric()))
print("Alfabetico: {}".format(x.isalpha()))
print("Alfanumerico: {}".format(x.isalnum()))
print("Maiusculo: {}".format(x.isupper()))
print("Minusculo: {}".format(x.islower()))
| true |
32706336a021a7199d7b03794b29651f5ed4c10c | Python | Mocardo/jogo-ces22 | /ai.py | UTF-8 | 797 | 2.8125 | 3 | [] | no_license | import scipy
import numpy
class AI:
def __init__(self, game):
self.enemies = game.enemies
self.game = game
def update_aliens(self):
self.brownian_movement()
self.shoot()
def brownian_movement(self):
for enemy in self.enemies:
enemy.velocity[0] += nump... | true |
c4416289aaf4a20f88ccca219ccc3dfb11afaad2 | Python | chm-ipmu/belle2 | /flavour_tagging/fit_for_wrong_tag_fraction.py | UTF-8 | 4,731 | 2.734375 | 3 | [] | no_license | """Simultaneous fit to sign(PDF)*sign(FT_VAR) to measure wrong-tag fraction"""
import typing
import ROOT
FILENAME = (
"/ghi/fs01/belle2/bdata/users/abudinen/flavorTagging/"
"release-04-00-03TestSviatSel/Belle2_MC12_mixedb02all.root"
)
TREENAME = "variables"
PRECUT = "isSignal && abs(FBDT_qrCombined) < 1.1"
MI... | true |
e1d13ab77738dde17d13cb89057ef735d21e3934 | Python | zikzzik/blockchain_from_scratch | /src/my_lib/MerkleProof.py | UTF-8 | 665 | 2.984375 | 3 | [] | no_license | from hashlib import sha256
from .Transaction import Transaction
from merkletools import MerkleTools
class MerkleProof:
def __init__(self, root: str = None, hash_list: list = None, not_found=False):
self.root = root
self.hash_list = hash_list
self.not_found = not_found
def is_in_m... | true |
b72c464db540172ca25da6506dca48dd0db62691 | Python | RedMakeUp/DataMiningCourseDesign | /Python/SVM/train.py | UTF-8 | 1,188 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from sklearn.svm import SVC
from sklearn.decomposition import PCA
from sklearn.pipeline import make_pipeline
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import GridSearchCV
from sklearn import metrics
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
impor... | true |
7f5578f4c374b4f9777e640fdafd41a28052cc3d | Python | giantoak/2016_summer_camp | /classifier/Classifier.py | UTF-8 | 4,869 | 2.796875 | 3 | [] | no_license |
# coding: utf-8
# # Classifier
#
# No age or image data, since those seem to be the explanatory variables the classifiers love the most.
# We also leave out counts of incalls, outcalls, or "incalls and outcalls".
#
# ## Imports
# In[1]:
from itertools import chain
import html
import ujson as json
import multiproc... | true |
7105f3019c86123c65cfa406356ae7eba9dddf05 | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4478/codes/1644_2711.py | UTF-8 | 350 | 3.453125 | 3 | [] | no_license | valor = float(input("dinheiros: "))
RU = int(input("quantidade de tickets: "))
tickets = float(input("valor do tickets: "))
passe = int(input("quantidade de passes: "))
bus = float(input("valor da passagem estudantil: "))
total = RU*tickets+passe*bus
if(total<=valor):
mensagem = "suficiente"
else:
mensagem = "insufic... | true |
0ff1de5f78ea30d18de671b125c635fb92cd04d6 | Python | Aasthaengg/IBMdataset | /Python_codes/p03359/s727101910.py | UTF-8 | 58 | 2.859375 | 3 | [] | no_license | a,b = list(map(int,input().split()))
print(a-1+(b//a>=1))
| true |
23c92c090db19505709fc3e9e487b04bd20ea6ba | Python | fp-computer-programming/cycle-3-labs-p22dhealy | /lab_3-2.py | UTF-8 | 296 | 3.765625 | 4 | [] | no_license | # author: DMH 9/29/21
points = int(input("How many points does your team have?"))
if points == 15:
print("You got a gold medal!")
elif points > 11:
print("You got a silver medal!")
elif points > 7:
print("You got a bronze medal!")
else:
print("You did not get a medal!")
| true |
6181f9db19b24d4d4b65341b7cfcf5a956c436cb | Python | nevmenandr/index_tolstoy_bot | /page_return.py | UTF-8 | 596 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 19.05.2017 11:49:35 MSK
import json
import re
import urllib.request
def person_get_mentions(num):
if re.search('[^0-9]', num):
return None
mentions_url = 'http://index.tolstoy.ru/person/mentions/'
response = urllib.request.urlopen(mentions_url + num... | true |
ac819f1d95b1b2083884df9c7127c963a45d59d2 | Python | ninja-22/HOPTWP | /CH2/methods_adv.py | UTF-8 | 1,125 | 3.921875 | 4 | [] | no_license | #!/usr/local/bin/python
def method_1(*args):
print("------------------------")
print("Method_1 ")
print(f"Received: {args}")
sum = 0
for arg in args:
sum = sum + arg
print(f"Sum: {sum}")
print("------------------------")
def method_1_rev(a = 0, b = 0, c = 0, d = 0):
print("----... | true |
81e17b2cd143bebbe5febb6dea22dcd80187053f | Python | martapienkowska/python_first_steps | /Lista_1/1_25.py | UTF-8 | 419 | 3.640625 | 4 | [] | no_license | a = float(input("a: "))
b = float(input("b: "))
c = float(input("c: "))
def fun_delta():
delta = (b**2) - (4 * a * c)
return delta
if fun_delta() > 0:
X1 = (- b - (fun_delta() ** (1/2))) / (2 * a)
X2 = (- b + (fun_delta() ** (1/2))) / (2 * a)
print("X1 =", X1)
print("X2 =", X2)
elif fun_delt... | true |
9ad0c2eca505d5380a6dbbdc42de5a3a3234b5b9 | Python | briannakeune/cs-module-project-hash-tables | /notes.py | UTF-8 | 1,083 | 4.1875 | 4 | [] | no_license | '''
A hash function takes an input (string) and changes it into an integer
'''
def naive_hashing(str, list_len):
bytes_representation = str.encode()
sum = 0
for byte in bytes_representation:
sum += byte
return sum % list_len
starter_colours = [("aqua", "#00FFFF"),
("beige... | true |
bac77a56418be0dbd2bfb3790f514db782919c6b | Python | ericchou1/tps-collection | /AWS/ddosElasticSearch_to_S3_Webpage.py | UTF-8 | 2,031 | 2.515625 | 3 | [] | no_license | import requests, pprint, json
import boto3, pygal
import time
base_es = '<your instance>.es.amazonaws.com/'
# GET Request
response = requests.get(base_es+'a10_colocation_stat_brief/_search?q=SerialNumber:TH30A53313370032&pretty')
#print(response.json()['hits']['hits'])
for i in response.json()['hits']['hits']:
p... | true |
1cd660d58197a5a929c12fac984407b739674100 | Python | jessekrubin/project-euler | /python/problem3.py | UTF-8 | 232 | 2.734375 | 3 | [] | no_license | from itertools import count, takewhile
from lib.factorization import factor_method
def solution(N = 600851475143):
for i in takewhile(lambda _: N > 1, count(2)):
while N % i == 0: N //= i
return i
print(solution()) | true |
d85a562d37a7abf7b65494f9f4f6fe44b3499741 | Python | Spencerappleton/all_python_attempt2 | /Python/Spencer Appleton chapter 4 while/Spencer Appleton while loops | UTF-8 | 119 | 2.96875 | 3 | [] | no_license | import random
my_list = ["rock", "paper", "scissors"]
random_index = random.randrange(3)
print(my_list[random_index])
| true |
c0f9ebece2ee70e7ead352055173881b9b20a37e | Python | mikecolistro/Python_Files_AI | /readfile.py | UTF-8 | 158 | 3.109375 | 3 | [] | no_license | text_file = open("catfacts.txt","r")
lines = text_file.readlines()
x = len(lines)
y = 0
for y in range(0, x):
print lines[y]
y += 1
text_file.close()
| true |
456b66497a785fdbc13058c0b1611a12d451c0ec | Python | anonomouscoder/territories | /testAtWork/card.py | UTF-8 | 2,812 | 3.03125 | 3 | [] | no_license | import pygame.sprite, drawUtils
from drawUtils import *
CLUB = 1
DIAMOND = 2
HEART = 3
SPADE = 4
JACK = 11
QUEEN = 12
KING = 13
ACE = 1
class Card(pygame.sprite.DirtySprite):
suit = CLUB
rank = 2
rankImageName = ""
suitImageName = ""
cardImageName = ""
toolTip = ""
def getCardValue(self):
... | true |
2e38e0f89b446c7f51c87ae8213c5b55a479e1f8 | Python | Pinioo/L-shape | /gauss.py | UTF-8 | 1,229 | 3.203125 | 3 | [] | no_license | def print_matrix(A):
for row in A:
print(row)
def print_equation_system(system):
(A, B) = system
for i, row in enumerate(A):
print(str(row) + " " + str([B[i]]))
def gaussian_matrix(A, B):
l = len(A)
for current_index in range(l-1):
max_row = max(range(current_index, l-1), k... | true |
113f607483d832c49e5cda24f328d8bba83a90aa | Python | kateroukie/greeklish-wordlist | /gr_trans2.py | UTF-8 | 3,030 | 2.828125 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# pygr2gl - greek text to greeklish converter written in Python.
#
# Author : George Notaras <George[D.O.T]Notaras[A.T]gmail[D.O.T]com>
# Homepage: http://www.g-loaded.eu/2006/12/18/pygr2gl-greek-to-greeklish-converter/
# Licence : GPLv2
#
#
# Accepts data either from s... | true |
f073f31cc677106b8c9d57cce4554bf38e5b35c4 | Python | xlbruce/audio_zap | /transcribe.py | UTF-8 | 731 | 2.84375 | 3 | [] | no_license | #-*- coding: utf-8 -*-
import os
from _io import BufferedRandom
import speech_recognition as sr
from pydub import AudioSegment
def get_transcription(audio_filename:str) -> str:
sound = convert_to_wav(audio_filename)
with sr.AudioFile(sound) as source:
r = sr.Recognizer()
audio = r.record(sourc... | true |
89971fbb031ae17d2f3ad5482c33c5f0d1c517d7 | Python | ankitsingh03/code-python | /gfgs/Array/3. array rotation.py | UTF-8 | 136 | 3.46875 | 3 | [] | no_license | def rotate(lst, l):
for i in range(l):
lst.append(lst.pop(0))
return lst
lst = [1, 2, 3, 4, 5]
print(rotate(lst, 2))
| true |
fb20d0b09b34cd3368ecc3645c74950ef489b7cb | Python | yoshi61/Artificial-Intelligence | /assignment1/robotplanner.py | UTF-8 | 5,219 | 3.421875 | 3 | [] | no_license | import math
import sys
from pprint import pprint #for debugging
#ct = 0
##################################define Node class#################################
class Node(object): #derived from object
def __init__(self,x,y):
self.pos = (x,y)
self.hStar = abs(x-self.goal[0]) + abs(y-self.goal[1])
... | true |
e4bf5a5c80fb592cc4047dbaee22663a796beeed | Python | simemon/HackerRank | /Algorithms/Dynamic_Programming/Red_John_Is_Back.py | UTF-8 | 995 | 3.34375 | 3 | [] | no_license | '''
https://www.hackerrank.com/challenges/red-john-is-back
'''
# Enter your code here. Read input from STDIN. Print output to STDOUT
import math
def ncr(N,k): # from scipy.comb(), but MODIFIED!
if (k > N) or (N < 0) or (k < 0):
return 0L
N,k = map(long,(N,k))
top = N
val = 1L
while (top > ... | true |
559e24af47c0ee794c3e91acac013a30e74c7041 | Python | davep-github/dpw | /bin/side-by-side.py | UTF-8 | 1,138 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
import sys, os, string
width = 80
class eof_obj:
def readline(*pargs, **kargs):
return ("*** EOF ***")
def side_by_side(files, width):
n = len(files)
pad = " " * width
sep = " | "
sep_len = len(sep)
max_line = (width - (n-1)*sep_len) / n
lines = [''] * n
... | true |
40d1947b742dfbdb8ee6145665b0ef2a60e02acb | Python | Godot-dev/IceCubeGame | /projectile.py | UTF-8 | 1,762 | 3.453125 | 3 | [] | no_license | import random
import pygame
class Projectile(pygame.sprite.Sprite):
def __init__(self, game):
super(Projectile, self).__init__()
self.game = game
self.velocity = random.randint(2, 4)
self.direction = random.randint(0, 3)
self.angle = 90 * self.direction
self.image =... | true |
453a8beb96fffa41c9d45cb19a9d97969b0e2f48 | Python | jonaac/Reinforcement-Learning-Safety-Project | /code/intelligent_agent.py | UTF-8 | 1,432 | 2.8125 | 3 | [] | no_license | # Intelligent Agent Class
from environment import Environment
class Agent:
current_state = None
env = None
knowledge_b = None
def __init__(self,state,env,k_base):
self.current_state = state
self.env = env
self.knowledge_b = k_base
def transition_function(self,action):
next_state = self.env.transitions[... | true |
f30128a1871298f249fa9fb434f067f9cdfffa02 | Python | mattyradiuk/Server | /server.py | UTF-8 | 1,235 | 2.5625 | 3 | [] | no_license | from socket import *
import sys
host = ''
port = 6789
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind((host, port))
serverSocket.listen(5)
x = gethostbyname(gethostname())
while True:
#Establish the connection
print('Ready to serve...')
connectionSocket, addr = serverSocket.acce... | true |
06e175225f9aa93dd7793f8750a82e65b44997b2 | Python | An-Shan/twstock-predict | /k_line.py | UTF-8 | 2,171 | 2.859375 | 3 | [] | no_license | # basic
import numpy as np
import pandas as pd
# # get data
# import pandas_datareader as pdr
# visual
import matplotlib.pyplot as plt
import mpl_finance as mpf
import seaborn as sns
# #time
# import datetime as datetime
#talib
import talib
def draw_k_line(df_Stock):
sma_5 = talib.SMA(np.a... | true |
d5a9b85e4de613720933fe61a4ffe5853c949f34 | Python | mheerspink75/data_visualization_with_python | /00_data_visualization_notes/05_dynamic_annotation_of_last_price.py | UTF-8 | 1,549 | 3 | 3 | [] | no_license | import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.ticker as mticker
from mpl_finance import candlestick_ohlc
from pandas_datareader import data
import pandas as pd
start_date = '2019-10-01'
end_date = '2019-11-01'
df = data.DataReader('AAPL', 'yahoo', start_date, end_date)
# ensuri... | true |
6e3a49a90303187cc32032f95d2b45db9aa22c1a | Python | AlexGaiser/RavenousDataBot | /DonaldBot/csvmaker.py | UTF-8 | 967 | 3.1875 | 3 | [] | no_license | # CSV maker module
import os
def csvmaker(csvname, headers):
global csvfilepath
cwd = os.getcwd()
csvfilepath= cwd+ '\\' + csvname
print(csvname)
if not os.path.isfile(csvname):#creates a csv with headers if doesn't exist in current directory
f = open(csvname,"w")
f.write(headers)
... | true |
74267dff63f952199f9d60df1a53f7776c302961 | Python | yuki2222/my_new_repo | /object_oriented.py | UTF-8 | 768 | 4.4375 | 4 | [] | no_license |
"""
class Data:
def __init__(self, a, b):
self.nums = [a, b]
class Avatar(Data):
def area(self):
return self.nums[0] * self.nums[1]
d2 = Avatar(3, 2)
print(d2.area())
d1 = Data(5, 6)
# 一度オブジェクトを介さないと変数へアクセスできない
# オブジェクトの中に変数やメソッドがあるイメージ
d1.nums[1] = 9
# 変数へ直接アクセス可能
data1 = [3, 4]
data2 = ... | true |
b086eeea9472ef8ca754ce6298b540dae6016eeb | Python | JoseTg1904/-LFP-Proyecto2_201700965 | /cadena.py | UTF-8 | 269 | 2.671875 | 3 | [] | no_license | class Evaluacion():
def __init__(self,identificador,cadenas):
self.identificador = identificador
self.cadenas = cadenas
class Cadena():
def __init__(self,valor,validacion):
self.valor = valor
self.validacion = validacion | true |
2597512eb7fd59c0554f55817ba9cefc4a181fc3 | Python | Jiakun/all_autotests | /sedna/observer.py | UTF-8 | 4,925 | 2.65625 | 3 | [] | no_license | import requests
import logging.config
from sedna.config import SEDNA_LOG_CONF
class ObserverInfoType:
def __init__(self):
pass
SCENARIO = "Scenario test"
SCENARIO_STEP = "Scenario test result by step"
HA = "HA test"
END = "End"
class Observable:
def __init__(self):
self.regi... | true |
a1ceb01b5d973f88e7334ce489ca365931c1f8a6 | Python | MichalOleszak/mopy | /torch/freezing.py | UTF-8 | 681 | 2.84375 | 3 | [] | no_license | from torch import nn as nn
def set_frozen(model: nn.Module, freeze: bool) -> None:
"""
Freeze or unfreeze all parameters of the given model.
:param freeze: freeze parameters if `True` or unfreeze if `False.
"""
for param in model.parameters():
param.requires_grad = not freeze
def get_unf... | true |
49d1248185faaffe656fcba7a9cc648fda7d32ee | Python | ajw2329/splice_lib_utils | /get_competing_splice_sites.py | UTF-8 | 32,859 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
import sys
from splice_lib import splice_lib
import copy
import argparse
import subprocess
from maxentpy import maxent # must be installed
import gen_methods
import pandas as pd
def get_donors_acceptors(event):
'''
Identify donor, acceptor splice sites in a
splice_lib-style event dictionary en... | true |
cc257b7b5530da02a22beef6a4b6c9150919fb79 | Python | 9217392354A/astro-scripts | /fornax-figures/smass.py | UTF-8 | 3,018 | 2.609375 | 3 | [] | no_license | #program to genorate stellar masses from optical colours and 2mass magnitudes. For
# galaxies that only have a bt mag then we will fit a function to the
# other galaxies giving a fuction for btmag to stellar mass.
# Chris Fuller August 2013
#import mods
from atpy import Table
import numpy as np
from os.path import ... | true |
5d38926562cd9f29eb895aadf81d7456b358155d | Python | bearkent/running_with_python | /Euler_Matrices.py | UTF-8 | 680 | 2.8125 | 3 | [] | no_license | import numpy as np
from math import *
ax=
ay=
az=
j = np.array([cos(ay)*cos(az), -sin(az)*cos(ax)+sin(ax)*sin(ay)*cos(az), sin(ax)*sin(az)+cos(ax)*sin(ay)*cos(az)]
[cos(ay)*sin(az), cos(az)*cos(ax)+sin(ax)*sin(ay)*sin(az), -sin(ax)*cos(az)+cos(ax)*sin(ay)*sin(az)]
[-sin(ay), cos(ay)*sin(ax), cos(ax)*cos(ay)])
def Eul... | true |
ac55ad9ca26d97f7ace67238c3c596006d1c17a9 | Python | Codechef-SRM-NCR-Chapter/30-DaysOfCode-March-2021 | /answers/sakshi/Day 2/question1.py | UTF-8 | 170 | 3.140625 | 3 | [
"MIT"
] | permissive | #Day 2
n=int(input())
k=n
num1=0
while(n>0):
num1=(num1*10)+(n%10)
n=int(n/10)
if(k%2!=0 and num1%2!=0):
print("Emirp No")
else:
print("Not an Emirp No")
| true |
2518fc993c6b83e2af75b3b456a757646991e8c8 | Python | ajgithub5/demand- | /Model_des_w_damping.py | UTF-8 | 9,684 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 17 07:13:14 2020
@author: p3000445
"""
from data.preprocessing import shorter_week_deflation, deflation_logic
import pandas as pd
import numpy as np
#from statsmodels.tsa.api import SimpleExpSmoothing, Holt, ExponentialSmoothing
from statsmodels.tsa.holtwinter... | true |
692717c2cfe5bf6e74471d9135bb47cab6d4c2e8 | Python | wbond/csrbuilder | /csrbuilder/__init__.py | UTF-8 | 17,445 | 2.5625 | 3 | [
"MIT"
] | permissive | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import inspect
import re
import sys
import textwrap
from asn1crypto import x509, keys, csr, pem
from oscrypto import asymmetric
from .version import __version__, __version_info__
if sys.version_info < (3,):
int_ty... | true |
10c4def07e1d4444a16f02882e8ade1edcadd718 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_206/545.py | UTF-8 | 951 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
def solve_case():
pass
def main(argv):
fout_name = argv[1].split(".")[0] + ".out"
fout = open(fout_name, "w")
fin = open(argv[1])
nb_cases = int(fin.readline())
for case_no in range(1, nb_cases+1):
print case_no
... | true |
e98a0f74fb828c55f350449c42fa907e9972d55b | Python | Sobhit25/21-days-of-programming-Solutions | /Day5.py | UTF-8 | 267 | 3.59375 | 4 | [] | no_license | b = input ("Enter a binary : ")
my_list = []
for char in b:
my_list.append(char)
k = 0
sum = 0
for i in reversed(my_list):
sum = sum + int(i)*(2**k)
k=k+1
print ("Your character is {}".format(chr(sum)))
print ()
input("Enter any key to exit") | true |
8d3ffd791070ec98f2f2aff1d4a2da0c1804fdd8 | Python | NohYeaJin/programmers_problem | /programmers_2016.py | UTF-8 | 310 | 3.375 | 3 | [] | no_license | def solution(a, b):
months=[0,31,29,31,30,31,30,31,31,30,31,30,31]
days=["FRI","SAT","SUN","MON","TUE","WED","THU"]
total = 0
for i in range(a):
total = total + months[i]
total = total + b - 1
total = total % 7
answer = days[total]
return answer
print(solution(12,31))
| true |
8e25847132ddc94a0d8abeaa097b97a44aea2d8c | Python | Tylerremmie/Parser-Lexer | /main.py | UTF-8 | 1,245 | 3.171875 | 3 | [] | no_license | import unittest
from lexer import Lexer
from parserr import Parser
file = open(raw_input("Enter Filename: "),'r')
data = file.readlines()
file.close()
currentline = 1
for lines in data:
print "Proposition: " + lines.rstrip()
tokenlist = Lexer(lines.rstrip()).tokenize(currentline)
print "Le... | true |