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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
681b0570a8ec98c3b1e016bc364cae7be33bc9d6 | Python | sweet-home-of-python/Pythonicus | /polzuchii/udav_secularizovanniy.py | UTF-8 | 4,210 | 3.21875 | 3 | [] | no_license | # ver 0.1
import pygame
import time
import random
# Параметры наблюдательного, о кошка!
FPS = 60
Resolution = 1200,600 # размер экрана
colors = {'black': (0,0,0),
'white':(255,255,255),
'red':(255,0,0),
'green':(0,255,0),
'blue':(0,0,255)}
#Инициализация длиннохвостог... | true |
6de081a25a487da60e896c9c4171d143cb33d14d | Python | SimonZsx/clipper | /clipper_admin/logs/archive_imagequery_bigball/get_oursystem_c1_average.py | UTF-8 | 279 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive |
with open("./c1_oursystem_100req.log") as c1_file:
c1_times = c1_file.readlines()
c1_file.close()
# print(c1_times)
total = 0
for t in c1_times:
total += float(t)
print("Total: " + str(total))
print("c1 Average time on our system: " + str(total/len(c1_times)))
| true |
d056b6ce7381b1b29ce66252c1e1b81be6c726f4 | Python | McKenzie-Lamb/Gerrymandering | /anton-code/gerrymander-to/old_code/src/simple_district.py | UTF-8 | 1,261 | 2.734375 | 3 | [] | no_license | from __future__ import print_function
import sys
sys.path.append('../')
from include_lite import *
class SimpleDistrict:
def __init__(self, code, ratio):
self.__code = code
self.__ratio = ratio
def get_dem_ratio(self):
return self.__ratio
def set_dem_ratio(self, r):
self... | true |
5c5476fc6b0e69b1f8de94a573405094617c46b1 | Python | Evilzlegend/Structured-Programming-Logic | /Chapter 03 - Understanding Structure/D2L Assignments/tiemens_tax.py | UTF-8 | 785 | 4.5 | 4 | [] | no_license | # Ask the user what their income is.
income = int(input("What is your income? "))
# If the user's income is $20,000 or less use:
if income <= 20000:
if income <= 20000:
tax = income*(.02)
print("Your tax rate is in the lowest tax bracket.")
# If the user's income is $50,000 or l... | true |
094d6df452a393556432e52dada331fefc2556d8 | Python | magibeg/Python | /AutomateTheBoringStuff/Chapter 2/FlowControl.py | UTF-8 | 453 | 4.46875 | 4 | [] | no_license | #No complete program this chapter so applying a loop and condition
keepRunning = True
yourName = input("What is your name? ")
while keepRunning == True:
print("Welcome " + yourName)
keepPlaying = input("Do you want to play a game? (yes/no): ")
if keepPlaying == "yes":
print("This game doesn't do ... | true |
1ce75bfe78647141ee53590f018735c391eb3193 | Python | michaeliq/reto_python | /kwranking.py | UTF-8 | 2,012 | 2.609375 | 3 | [] | no_license | from check_kw import Scrapping as sc
import db
from models import Keyword
from data import export_results_to_excel
if __name__ == '__main__':
db.Base.metadata.create_all(db.engine)
def keywords_como_lista_de_valores():
keywords = [(key.keyword_,key.position) for key in Keyword.get_all()]
return keywords
... | true |
bbb00e92e1459f9b96e1d55e8fed9ffa1578a730 | Python | gerv/eurovision-bingo | /bingo.py | UTF-8 | 4,847 | 2.734375 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/python
#
# To do: make number of cards configurable on command line
# Make contents of selection buckets configurable
import re
import os
from appy.pod.renderer import Renderer
import random
import copy
import math
NUMBER_OF_CARDS = 10
TEMPLATE = 'card-template-generic.odt'
# This should normally be the pr... | true |
ec8dd7ca78d512eb0c703cc12ac6852901405545 | Python | whoissahil/python_tutorials | /sets.py | UTF-8 | 475 | 3.796875 | 4 | [] | no_license | shoes = set(["Spizikes", "Air Force 1", "Curry 2", "Melo 5"])
# sets has no particular order
print (shoes)
#add a value to set
shoes.add("Demo")
print(shoes)
#delete a value
shoes.remove("Curry 2") #this might give error if missplelled so better use .discard which does the same but ignores if not spelled right
print... | true |
2eb37a9ff7526a63d826dc555dfb89b04d47c811 | Python | maomao-yt/paiza_past_set | /06_shiritori_2.py | UTF-8 | 1,162 | 3.53125 | 4 | [] | no_license | # よりコードを短くする
N, K, M = map(int, input().split())
player_num = [i for i in range(1, N + 1)] # プレイヤーの番号リスト
word_list = []
for i in range(K):
word_list.append(input())
shiritori_word = [] # しりとりで使った言葉を格納するリスト
before_word = ""
turn = 0
for i in range(M):
word = input()
if word not in word_list: # ルール1
... | true |
f85ce4573a8dc591a44e44da49c4d542af3b5068 | Python | lopentu/parallel-Chineses | /NER/+cs/src/srtloader.py | UTF-8 | 1,378 | 2.515625 | 3 | [] | no_license | import re
import pdb
serial_pat = re.compile("^[\ufeff]?\d+$")
timestamp_pat = re.compile("(?P<H>\d{2}):(?P<M>\d{2}):(?P<S>\d{2}),\d{3}")
def load_srt(fpath):
fin = open(fpath, "r", encoding="UTF-8")
buf = []
srt_list = []
start = None
end = None
for ln in fin.readlines():
m_serial = ... | true |
9c6718b9f0582780152ad05d5b674804289941e7 | Python | kinsuord/tree2code | /models.py | UTF-8 | 19,722 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torchvision.models as models
from utils.tree import Tree
class ChildSumTreeLSTM(nn.Module):
'''
input: Tree(in_dim)
output: state(mem_dim)
'''
def __init__(self, in_dim, mem_dim):
super(ChildSumTreeLSTM, self).__init__()
... | true |
d89d9d89a9411e4704ff9ee68d950a0a8d38771f | Python | romanmayer1303/Twitter-Analysis-BigData | /twitterPlot.py | UTF-8 | 4,780 | 2.859375 | 3 | [] | no_license | import sys
import os
import matplotlib.pyplot as plt
import numpy as np
def numbersToDate(numberArray):
dateArray = []
for i in range(len(numberArray)):
dateArray.append(str(numberArray[i])[6:]+"/"+str(numberArray[i])[4:6]+"/"+str(numberArray[i])[0:4])
return dateArray
def plotTimeEvolution(directoryName, titl... | true |
ca99266613e5f62e602ee5744441b00ee24fbce0 | Python | summerv/NetInterpret-Lite | /storage_layer.py | UTF-8 | 15,135 | 2.640625 | 3 | [
"MIT"
] | permissive | import os
os.environ["SPARK_HOME"] = "/home/vicky/spark-2.3.0-bin-hadoop2.7/"
os.environ["PYSPARK_PYTHON"] = "/home/vicky/anaconda3/bin/python"
from pyspark import SparkContext
from pyspark.sql import Row, SparkSession
import numpy as np
from pyspark.sql.types import *
import time
import random
import pyspark.sql.fun... | true |
3d26852a897d7471f95718888c7b2762afe97dfe | Python | bavlayan/crypto101 | /Vigenere/Vigenere.py | UTF-8 | 1,849 | 3.890625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
class Vigenere:
def __init__(self, key_word):
# Turkish alphabet
self.__letters = ["a", "b", "c", "ç", "d", "e", "f", "g", "ğ", "h", "ı", "i", "j", "k",
"l", "m", "n", "o", "ö", "p", "r", "s", "ş", "t", "u", "ü", "v", "y", "z"]
self.__key_w... | true |
43ec68b216f8c43387c89c80b6dcf1b0007b859b | Python | wsj-7416/Project-Unicom | /Code/PreProcessor/Data_preprocessing/datareshape_final.py | UTF-8 | 1,482 | 2.78125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import os
'''只需要将rootdir修改为原始数据的目录即可'''
'''对文件夹下的6个数据文件进行预处理'''
zerocoordi = pd.read_csv('zerocoordi.csv',header=0).iloc[:,0].tolist() #无数据的网格编号
rootdir = '../raw_data'
data_files = os.listdir(rootdir)
final = pd.DataFrame(columns=range(54*43))
for data_file in data_files:
... | true |
1b467457a2517a90b147fe25cca31dab899c6a20 | Python | Jia35/LeetCode | /Challenge/c30-Day_LeetCoding/p560_medium.py | UTF-8 | 733 | 3.828125 | 4 | [] | no_license | # 560. Subarray Sum Equals K
# https://leetcode.com/problems/subarray-sum-equals-k/
from collections import defaultdict
from typing import List
class Solution:
def subarraySum(self, nums: List[int], k: int) -> int:
# 參考答案
sums_so_far = defaultdict(int)
our_sum = 0
num_subarrays = ... | true |
8d1803ca4f56832b3e83ad1eca7caf955af566e1 | Python | lunar-mycroft/STDeepLearningProject | /recomender.py | UTF-8 | 2,622 | 2.515625 | 3 | [] | no_license | import tensorflow as tf
import pandas as pd
import numpy as np
import scipy.sparse as sp
from tqdm import tqdm
from util import init_variable, embed, get_variable, loadModal, loadTestData, preprocessTestData
class Recomender():
def __init__(self,modelPath):
self.df, self.users, self.items, self.numEvents... | true |
83c73a55cca0eeb529bf975d6790d95806907470 | Python | Aryamanz29/DSA-CP | /codeforces/ladder/beautifulmatrix.py | UTF-8 | 203 | 3.296875 | 3 | [] | no_license | mat = []
for i in range(5):
mat.append(list(map(int,input().split())))
i, j = 0, 0
for row in range(len(mat)):
if 1 in mat[row]:
i, j = row , mat[row].index(1)
print(abs(i-2)+abs(j-2)) | true |
e4239982886264d2ffbd4eeaa6ae26e0e335e381 | Python | awnion/contests | /olympiads.ru/08-09/a.py | UTF-8 | 380 | 3.46875 | 3 | [] | no_license | #!/usr/bin/python
def GetAnswer(a, b):
if a == 21: return 2
if b == 21: return 3
return ((a + b) / 5) % 2 != 0
FIN = open("a.in", "r")
FOUT = open("a.out", "w")
InputData = FIN.read().split()
Answers = ["Vasya serves", "Petya serves", "Vasya wins", "Petya wins"]
print >> FOUT, Answers[GetAnswer(int(I... | true |
32545ba6bde246c7c286098344b316cd88d2b831 | Python | s41m1r/personal_data_science_projects | /hp_tuning_gcp/ai_platform_api_call.py | UTF-8 | 1,796 | 2.75 | 3 | [] | no_license | from googleapiclient import discovery
from google.oauth2 import service_account
import pandas as pd
import json
# Define the credentials for the service account
credentials = service_account.Credentials.from_service_account_file(<PATH TO CREDENTIALS JSON>)
# Define the project id and the job id and format it ... | true |
fc5413bb4d9dae3c3e6994c45408406e587a9049 | Python | MedVisBonn/eyelab | /eyelab/dialogs/help/layerannotation_help.py | UTF-8 | 1,262 | 2.828125 | 3 | [
"MIT"
] | permissive | from eyelab.dialogs.help.help_dialog import HelpWindow
help_text = """
# Layer Annotation Guide
An OCT Layer in Eyelab is combination of explicit layer heights provided per A-scan,
and a cubic spline curve which can be manipulated by adding, removing or moving the
curves knots.
## Adding a new Layer
Create a new la... | true |
85f392b5469bbd3e470ae925d7e641afb026cb14 | Python | jwestfromtheeast/CodingChallenges | /python/medium/1007MinimumDominoRotationsForEqualRow.py | UTF-8 | 824 | 2.953125 | 3 | [] | no_license | class Solution:
# Complexity: Time O(n), Space O(1)
def minDominoRotations(self, A: List[int], B: List[int]) -> int:
if len(A) != len(B):
return -1
a_count = [0 for i in range(7)]
b_count = [0 for i in range(7)]
same_count = [0 for i in range(7)]
for ... | true |
68077fa0440c257f479ad9cf7e32c34e7ae53ea1 | Python | mri-group-opbg/rmi-luciani | /luciani/algorithms/centrality.py | UTF-8 | 2,373 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive |
import numpy as np
import scipy as sp
import networkx as nx
import bct
from scipy.spatial import distance
import pandas as pd
"""
beta could be 0.5 or -0.5
"""
def bonachic_centrality_und(CIJ, beta=0.5):
alfa = 1
e = np.ones((1, CIJ.shape[0]))
I = np.identity(CIJ.shape[0])
s = beta*CIJ
g = I - s
... | true |
37e43ea670e736c57092f50f89f6869b055b6a4c | Python | pection/Humanoid | /Humanoid_Robot/Whitespace_Interpreter.py.txt | UTF-8 | 13,205 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
# A Whitespace interpreter in Python with limited debugging capabilities
# By Miguel Colom
# http://mcolom.info
# GNU General Public Licence (GPL)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Publi... | true |
bdaf4c6c3f30e93804435a118f739340a6352c6e | Python | Nishanth-Vikraman/numerical-techniques-for-ode | /Numerical Techniques.py | UTF-8 | 5,561 | 3.40625 | 3 | [] | no_license | """
Created on Fri Apr 9 16:02:16 2021
@author: nishanth
"""
def f1(x, y, *z):
return (1 / (x + y))
def f2(x, y, z):
return (x*z - 4*y)
# RK-4 method
def rk4(x0, y0, xn, n):
# Calculating step size
h = (xn-x0)/n
print('\n--------SOLUTION--------')
print('-------------------------')
for ... | true |
c2906cd0c1ac44370af573b350f1bbd5e0836b62 | Python | jafriyie1/Poke-Suite- | /Phase 1/pokemon_scrap_three.py | UTF-8 | 2,496 | 3.046875 | 3 | [] | no_license | """Web Scrapper for Bulbapedia poxedex"""
from bs4 import BeautifulSoup
from urllib.request import urlopen, HTTPError
import re
import json
data_list = []
def check_open(url):
"""Checks if the webpage can be opened"""
try:
urlopen(url)
print("The webpage has opened")
return "Execute"
except HTTPError as... | true |
ab0ad7f4cd36e030e3baf55eb001c658dc6d9e9b | Python | yeejlan/ml_practice | /neg_pos/predict.py | UTF-8 | 3,128 | 2.6875 | 3 | [] | no_license |
import numpy as np
import pandas as pd
import jieba
import re
import h5py
import pickle
import matplotlib.pyplot as plt
from keras.models import Sequential, load_model
from keras.layers import Dense, Activation, Dropout, Embedding
from keras.layers import LSTM
from keras.callbacks import EarlyStopping
import os
im... | true |
1d67714c7f1645c92e79d26074320d361eb6338a | Python | AJ-Data06/SQL_Alchemy_Challenge | /weather_app.py | UTF-8 | 2,859 | 2.578125 | 3 | [] | no_license | import numpy as np
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify
engine = create_engine("sqlite:///hawaii.sqlite", echo=False)
Base = automap_base()
Base.prepare(engine, reflect=True)... | true |
dabbdda8ad11bbf0544800434b22cdd5227acb78 | Python | dannymeijer/level-up-with-python | /assignments/3/product_of_positive_digits.py | UTF-8 | 653 | 4.59375 | 5 | [
"MIT"
] | permissive | """
Assignment 3:
- You are given a positive integer.
- Your function should calculate the product of the digits excluding any zeroes.
- Name the function "product_of_positive_digits"
Input: A positive integer.
Output: The product of the digits as an integer.
For example:
> The number given is 123405.
> The resu... | true |
063cc3b1dd3bf88243f917f47b3ffccfec617214 | Python | AD1024/JsonParser | /tokenizer/Tokenizer.py | UTF-8 | 7,878 | 3.046875 | 3 | [] | no_license | from ..exceptions.Exceptions import *
from .Readers import *
from .Token import *
from .TokenEnum import *
from .TokenList import *
class Tokenizer(object):
def __init__(self, reader):
self.ch = ''
self.reader = PosReader(reader)
self.tokenList = TokenList()
self.tokenize()
de... | true |
3c3abf34cce9d26d00c26a48a70075ea306981a0 | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4188/codes/1752_1521.py | UTF-8 | 139 | 3.34375 | 3 | [] | no_license | n=int(input("capacidade: "))
e=int(input("estoque: "))
q=int(input("quantidade: "))
sem=0
while(e >0 ):
e=e -n + q
sem=sem+1
print(sem)
| true |
45e842d506ac1e8f534379f9dc426c872fe16b21 | Python | s724959099/py_pattern_note | /BehavioralPattern/strategy.py | UTF-8 | 1,926 | 3.859375 | 4 | [] | no_license | import types
class StrategyExample:
def __init__(self, func=None):
self.name = 'Strategy Example 0'
if func is not None:
self.execute = types.MethodType(func, self)
def execute(self):
print(self.name)
def execute_replacement1(self):
print(self.name + ' from execute 1... | true |
3f1569342e200d84531f152b26e7ea0711c7d68f | Python | hengyangKing/python-skin | /Python网络/01_udp_for_socket/udp协议绑定信息和接收数据.py | UTF-8 | 498 | 2.640625 | 3 | [
"MIT"
] | permissive | #coding=utf-8
from socket import *
#创建sorket
udpSocket = socket(AF_INET,SOCK_DGRAM);
#绑定本地的相关信息,绑定端口,如果一个网络程序不绑定,系统则会随机分配
udpSocket.bind(("",7788));#绑定ip地址和端口号,ip一般不用填写,表示本机的任何一个ip,端口号则指向了该进程
#等待接受对方发送的数据
recvData = udpSocket.recvfrom(1024);#1024表示本次接受的最大字节数
print(recvData);
#关闭
udpSocket.close();
| true |
658b4fb2d1f448c865349c68d1cb3c734f4849ab | Python | jiawei-zhang-columbia/IEORE4501-Final-Project | /squirrel_tracker/management/commands/export_squirrel_data.py | UTF-8 | 2,977 | 2.578125 | 3 | [] | no_license | from django.core.management.base import BaseCommand, CommandError
import pandas as pd
from squirrel_tracker.models import Sighting
class Command(BaseCommand):
help = 'Command to export squirrel data'
def add_arguments(self, parser):
parser.add_argument('path_to_csv', type=str)
def handle(self, ... | true |
fa7de6d65f1d70019eb32c5584810de29d0f15b8 | Python | lizzz0523/algorithm | /python/deprecated/test/test_leetcode.py | UTF-8 | 3,399 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
from unittest import TestCase
from leetcode.two_sum import two_sum
from leetcode.zigzag_conversion import zigzag_conversion
from leetcode.reverse_integer import reverse_integer
from leetcode.string_to_integer import string_to_integer
from leetcode.palindrome_number import palindro... | true |
b56dc15ae956c78f83e8f6a23b2651264c43bab5 | Python | astrajoan/CSCE-633 | /Homeworks/Homework3/test function.py | UTF-8 | 4,746 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 10 18:35:56 2020
@author: yvonn
"""
import numpy as np
x = np.array([1,2,1,2,2,1,1,2])
np.random.seed(1)
idx = np.where(x==1)[0]
print(idx)
y = np.random.choice(idx)
print(y)
y = np.random.choice(idx)
print(y)
import warnings
warnings.filterwarnings("ignore")
from ten... | true |
4b2b1128622dae60d90959d6053d4d63eb1b8b2f | Python | Algosse/Par_oscilloscope_control | /communication_serie.py | UTF-8 | 13,993 | 3.0625 | 3 | [] | no_license | """
Ce fichier est une bibliothèque écrite dans le cadre du PAr123 à l'Ecole Centrale de Lyon (année 2020/2021) et portant sur la réalisation d'une interface permettant de mener de façon automatique des attaques par canaux
electromagnétiques à l'aide d'une imprimante 3D.
Il contient la classe communication_serie écrite... | true |
9111dc3c941f299c71f7b2c409c3b46a010567b4 | Python | zerodel/pyalgo | /py/bi_divide_by_3.py | UTF-8 | 847 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# author : zerodel
# Readme:
#
'''
Created on Sep 3, 2016
@author: zerodel
'''
__doc__ = '''
'''
__author__ = 'zerodel'
def long_binary_remainder(str_bin):
remain_add = {1:2,
2:1}
res_map = dict([((x, y + 1), ( x + y )%3)
for... | true |
5d31a37f84c5e81596a3f3aed25eda3b38782e85 | Python | TeaCoffeeBreak/TF-Programs-for-Practice | /TF_CNN/bird_detector_transferlearning.py | UTF-8 | 6,355 | 2.796875 | 3 | [] | no_license | # Bird Detector (InceptionV3)
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.applications import InceptionV3
import time
import pathlib
import numpy as np
train_dir = "Datasets/Indian_Birds/Training"
valid_dir = "Dataset... | true |
50d498e571b75302f37235dd707f4d363f7a4b0a | Python | herren-algorithm-study/algorithm-basic | /yun/3주차/1120-문자열.py | UTF-8 | 476 | 3.140625 | 3 | [] | no_license | def calc_diff(x, y):
result = len(x)
for i in range(len(x)):
if x[i] == '*' or y[i] == '*' or x[i] == y[i]:
result -= 1
return result
a, b = input().split()
diff = len(b) - len(a)
result_min = len(a)
for left in range(diff+1):
prefix = '*'*left
suffix = '*'*(diff - left)
a... | true |
1c3efc560c78abade89298c30b251ee47777a764 | Python | RossCZ/PythonLearning | /auto_correct/handed/0vzor.py | UTF-8 | 105 | 2.859375 | 3 | [] | no_license |
# function interface
def divide(a: float, b: float) -> float:
# your code goes here...
return 0
| true |
a45ed182c0d836da3f29ac4e8d9ecb918d0ee144 | Python | shaitan1985/homeworks | /task_exception_free_land.py | UTF-8 | 911 | 3.484375 | 3 | [] | no_license | from math import sqrt
errs = {
'bad_full': "Не задана площадь участка",
'bad_bed' : "Не задана площадь грядки",
'bad_larger': "Размер грядки больше размера участка"
}
def get_sides(full_area):
ratio = full_area[1].strip()
a, b = map(int, ratio.split(":"))
x = int(sqrt(full_area[0] * 100 / (a... | true |
5187b589c0e1f459ef849850dcd17478a25ba91b | Python | lolwazi/jabberwocky | /tests/test_scenario.py | UTF-8 | 1,945 | 2.59375 | 3 | [
"MIT"
] | permissive | import sys
sys.path.extend(['.','..'])
from pdb import set_trace
# see https://click.palletsprojects.com/en/7.x/testing/
from click.testing import CliRunner
from catch.catch import main as catch
from bite.bite import main as bite
from arise.arise import main as arise
# commands in order from SCENARIO.md:
commands = [
... | true |
1c80d1fbc49badc48e317d497d6321fc742cf1ff | Python | erayridvan/Software-University-Python | /PBPythonConditionalStatementsLab/Area of Figures.py | UTF-8 | 574 | 4 | 4 | [] | no_license | import math
type_of_figure = input()
if type_of_figure == 'square':
side = float(input())
area = side * side
print(f'{area:.3f}')
elif type_of_figure == 'rectangle':
first_side = float(input())
second_side = float(input())
area = first_side * second_side
print(f'{area:.3f}')
elif type_of_f... | true |
39120a4a97c546ec500d2587719d72f475889a82 | Python | xxlanyacolsonxx/TranscribersOfReddit | /tor/strings/posts.py | UTF-8 | 2,733 | 2.625 | 3 | [
"MIT"
] | permissive | summoned_submit_title = (
'{sub} | {title} | We\'ve been summoned for a {commentorpost}!'
)
discovered_submit_title = (
'{sub} | {type} | "{title}"'
)
rules_comment = (
'If you would like to claim this post, please respond to this comment '
'with the word `claiming` or `claim` in your response. I will... | true |
f12fcf10948808e00d86dca856401ec4bf50b393 | Python | mensum33/Python-Assignment-BCPR301-Final | /Python assignment 1/PythonInterpreter/main.py | UTF-8 | 5,069 | 3.015625 | 3 | [] | no_license | from cmd import Cmd
from FileHandler.FileReader import FileReader
from FileHandler.FileWriter import FileWriter
from DataExtractor import DataExtractor
from UmlClass import UmlClass
from sys import argv
from Help import Help
import os
import re
class Interpreter(Cmd, Help):
def __init__(self, new_name... | true |
e264aeac91683bb74c9d8b877ec88afd04973b4c | Python | alexsalr/geo-scripting-wur | /project/get_places_by_state.py | UTF-8 | 1,145 | 3.40625 | 3 | [
"MIT"
] | permissive | import pandas as pd
from get_city_id import *
## The function gets a states lists as parameter and retrieves
## the placeID of the cities, using get_city_id function. Requires
## a csv file with US cities coordinates by state ordered by population.
def places_by_state(states, APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_... | true |
5b5ee590e7b824b1fd55d5436342579662e03435 | Python | PositronicsLab/wild-robot | /scripts/ex_plot_path.py | UTF-8 | 3,986 | 2.6875 | 3 | [
"MIT"
] | permissive | """
James Taylor
This example demonstrates plotting path data from processed training data. The
script must be run in the directory where the data resides.
The script will also call a script that uses the imagemagick program to crop
the plot to consistent dimensions. The crop script must be located in the same
dire... | true |
b30eda93ea024586d93d27f83b5b9a83c138b873 | Python | nkmk/python-snippets | /notebook/requests_redirect.py | UTF-8 | 615 | 3.15625 | 3 | [
"MIT"
] | permissive | import requests
url = 'https://en.wikipedia.org'
r = requests.get(url)
print(r.url)
# https://en.wikipedia.org/wiki/Main_Page
print(r.status_code)
# 200
print(r.history)
# [<Response [301]>]
print(len(r.history))
# 1
print(type(r.history[0]))
# <class 'requests.models.Response'>
print(r.history[0].url)
# https:... | true |
777a74e14e43d568dbbd4b6fa32397d0bcdbc9a0 | Python | Makeystreet/makeystreet | /woot/apps/catalog/decorators.py | UTF-8 | 2,219 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | from django.core.cache import cache
from django.http import HttpResponseRedirect
def login_required(cur_view):
def _wrapped_view(request, *args, **kwargs):
if not request.user.is_authenticated():
return HttpResponseRedirect("/launching_soon")
else:
return cur_view(request, ... | true |
7766aa5432d5b85e7cdc6c133f9888a074043852 | Python | kayla-louise/Python-HW-Assignments | /Documents/Web-Design/Python/KaylaCookCh6HW/KaylaCook6-10.py | UTF-8 | 524 | 3.875 | 4 | [] | no_license | #Kayla Cook
#Program 6-10 Prime List
#main module
def main():
testNum()
#testNum module
def testNum():
for n in range(1,101):
if isPrime(n):
if n==97:
print (n)
else:
print (n,",")
#isPrime module
def isPrime():
z = input... | true |
fc0fa3c707ba3d4be41f6177ab5eec1010da58b2 | Python | ruchitiwari20012/PythonTraining- | /converting Integer to string.py | UTF-8 | 181 | 3.5 | 4 | [] | no_license | num = 20
# Check and print type of num variable
print(type(num))
converted_num =str(num)
# Check and print type of converted_num variable
print(type(converted_num))
| true |
6a87136395558405c7c2d4c0c80352f7b8db46ae | Python | kelsensantos/boardgames_collection | /modules/classes.py | UTF-8 | 13,500 | 2.703125 | 3 | [
"CC0-1.0"
] | permissive | # BIBLIOTECAS E MÓDULOS EXTERNOS
import pandas as pd
from modules.database import Database
from decouple import config
from datetime import datetime
# MÓDULOS INTERNOS E SUBMÓDULOS
# noinspection PyUnresolvedReferences
from modules.fixpath import * # DO NOT REMOVE
from submodules.ludopedia_wrapper import Ludopedia_AP... | true |
a42fc87ffe6f06fa260d662e670f30131d9e83c5 | Python | pravishbajpai06/Projects | /12.py | UTF-8 | 942 | 4.5625 | 5 | [
"MIT"
] | permissive | #12-Happy Numbers - A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for whic... | true |
25740cf517ee6ba22cd06e7bea2d99d4d6f8ebbf | Python | rrpg/engine | /models/area.py | UTF-8 | 6,086 | 3.109375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Module to handle the areas in the game.
The world is divided in a grid of areas.
An area can have up to 4 neighbours (one for each cardinal point).
"""
from models.Model import Model
from models import item
import json
from core.localisation import _
from core import config
import core.ex... | true |
09c9fb9c0a404ffcc6c5ec9c13af77b415bbaa1d | Python | demetoir/ps-solved-code | /boj/1958.py | UTF-8 | 392 | 2.640625 | 3 | [] | no_license | A=raw_input()
B=raw_input()
C=raw_input()
n=len(A)+1
m=len(B)+1
l=len(C)+1
memo=[[[0]*l for j in range(m)] for i in range(n)]
ans=0
for i in range(1,n):
for j in range(1,m):
for k in range(1,l):
if A[i-1]==B[j-1] and C[k-1]==A[i-1]:
memo[i][j][k]=memo[i-1][j-1][k-1]+1
else:
memo[i][j][k]=max(memo[... | true |
0b95e5e6661c4fd06cf279a5fdac8b137f0b7974 | Python | CNwangbin/galpy | /galpy/df/constantbetadf.py | UTF-8 | 13,044 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | # Class that implements DFs of the form f(E,L) = L^{-2\beta} f(E) with constant
# beta anisotropy parameter
import numpy
from scipy import interpolate, integrate, special
from ..util import conversion
from ..potential.Potential import _evaluatePotentials
from .sphericaldf import anisotropicsphericaldf, sphericaldf
# T... | true |
c3742e3be8182ea774dcb5f2b264c9b91679a5f2 | Python | hermonator/CP1404 | /Workshop 4/numbers_addition.py | UTF-8 | 127 | 3.0625 | 3 | [] | no_license | __author__ = "Jesse Hermon"
file = open('numbers.txt', 'r')
total = 0
for line in file:
total = total + int(line)
print(total) | true |
77d5c897b23cfe04ed8b8dc2a43934356d62eab1 | Python | CutePotatoDev/PTests | /app/Test.py | UTF-8 | 2,222 | 2.703125 | 3 | [] | no_license | from DB import DB
from datetime import datetime
import TestFactory
class Test:
def __init__(self, uid):
self.db = DB.getiInstance()
self.uid = uid
self.user = ""
self.timestamp = 0
self.available = 0
self.complete = False
self.question = ""
self.an... | true |
8220c63a6c3ceb65baa50010e96ee159951a20e9 | Python | thangvu777/CardGames | /BlackJack.py | UTF-8 | 6,971 | 3.828125 | 4 | [] | no_license | # Description: Mini Blackjack game for 1-6 players
import random
class Card(object):
RANKS = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
SUITS = ("C", "D", "H", "S")
def __init__(self, rank=12, suit="S"):
# Q of spades
if rank in Card.RANKS:
self.rank = rank
... | true |
ff22850ef6cfab32e066e5c3e02a7c65cdb917c3 | Python | CapstoneProject18/-IOT-Based-Home-Security-System | /image.py | UTF-8 | 597 | 2.5625 | 3 | [] | no_license | def capture_image():
data= time.strftime("%d_%b_%Y|%H:%M:%S")
camera.start_preview()
time.sleep(5)
print data
camera.capture('%s.jpg'%data)
camera.stop_preview()
time.sleep(1)
sendMail(data)
//initialized the Picamera
camera = picamera.PiCamera()
camera.rotation=180
came... | true |
3de6bdf69d3a6981dbc385761691f5a825673501 | Python | FredHutch/wiki-code-templates | /ToolDev-Python-Template/tests/test_sample_module.py | UTF-8 | 2,174 | 3.484375 | 3 | [
"MIT"
] | permissive | """
This is an example of a unit test class to test a python module saved in the
template source code directory.
It is possible to have this test module automatically executed at each git push,
via Travis continuous integration tools. For manual execution, import this test
module into a jupyter notebook, or enter the... | true |
b1865ee8c1d19ab37c642e6c956593d22aa44e48 | Python | barbierincones/Python-Lists-Loops-Programming-Exercises | /exercises/12-Map_a_list/app.py | UTF-8 | 166 | 3.484375 | 3 | [] | no_license | Celsius_values = [-2,34,56,-10]
def fahrenheit_values(x):
x = x * 9/5 + 32
return x
result = list(map(fahrenheit_values, Celsius_values))
print(result)
| true |
81e2861a7a0ca3f51c2eae8fc1cfd64d79f3a4d5 | Python | VladPrytula/Deep_RL | /Chapter06/01_frozenlake_q_learning.py | UTF-8 | 4,009 | 3.28125 | 3 | [] | no_license | import gym
import collections
from tensorboardX import SummaryWriter
import numpy as np
ENV_NAME = "FrozenLake-v0"
GAMMA = 0.9
ALPHA = 0.2
TEST_EPISODES = 20
class Agent:
def __init__(self):
"""
in tabular Q-learning we are not processing all possible states and action, but
depend on the o... | true |
fb1cc1329d73c7df02cbe769c1874fe1cacb8fa1 | Python | ericksc/webinar | /map_reduce_dask_dataframe.py | UTF-8 | 1,190 | 2.765625 | 3 | [] | no_license | import functools
import dask
import dask.dataframe as dd
import pandas as pd
pdf = pd.DataFrame({
'x': range(0, 100),
'y': range(0, 100),
'z': range(0, 100)
})
ddf = dd.from_pandas(pdf, npartitions=8)
print('Number of partitions', ddf.npartitions)
def compute_stats(row):
return {
'sum': row... | true |
7ef14f9fe042065f1cbdcb8ee53c93ac71932ac7 | Python | Phongkaka/python | /TrinhTienPhong_92580_CH03/Exercise/page_85_exercise_02.py | UTF-8 | 331 | 4.03125 | 4 | [] | no_license | """
Author: Trịnh Tiến Phong
Date: 04/10/2021
Program: page_85_exercise_02.py
Problem:
2. Assume that x refers to a number. Write a code segment that prints the number’s
absolute value without using Python’s abs function.
Solution:
Display result:
15
"""
x = -15
if x < 0:
print(x*(-1))
el... | true |
3c7f5aff89e02d7d3dac59c576f4537c0d78c16f | Python | Uvenkatesh1238/DSP-LAB | /lab1_prog1(math_mul.py | UTF-8 | 479 | 3.953125 | 4 | [] | no_license | print "Enter the matrix in the following format\n[[a11,a12.....,a1n],[a21,a22.....a2n],......,[an1,an2,....ann]]"
print "Ex:[[1,2,3],[4,5,6],[7,8,9]"
a=input("Enter matrix A:")
b=input("Enter matrix B:")
p=len(a)
q=len(a[0])
m=len(b)
n=len(b[0])
c=[]
for i in range(p):
if(q!=m):
break
d=[]
for j in ra... | true |
3c59363708f9a8021b906abff8ba86dd65a8be33 | Python | Siddharthcmd/Python_Codes | /for1.py | UTF-8 | 422 | 2.796875 | 3 | [] | no_license | for passenger in "FC", "A", "FC", "C", "FA", "SP", "A", "A":
if(passenger == "FC" or passenger == "FA"):
print("No check required")
continue
if(passenger == "SP"):
print("Declare emergency in the airport")
break
if(passenger == "A" or passenger == "C"):
print("Proc... | true |
908977f0bcf0e2c3e9500a9f3f09827b0caaa610 | Python | sbozen/PG1926 | /PG1926/python/fuzzBuzz.py | UTF-8 | 301 | 4.03125 | 4 | [] | no_license | baslangic=int(input("Başlangıç değerini girin:"))
bitis= int(input("Bitis değerini girin: ") )
for a in range(baslangic,bitis+1):
if a%3==0 and a%5==0:
print("FizzBuzz")
elif a%3==0 :
print("Fizz")
elif a%5==0:
print("Buzz")
else:
print(a)
| true |
e0a75d526af57d5231cce2fb0f7c94860bd8d593 | Python | Yashi200/fiboonaci | /y5.py | UTF-8 | 135 | 3.84375 | 4 | [] | no_license | a=0
b=1
x=int(input("enter a number"))
print (a)
print(b)
for i in range(0,x-2):
c=a+b
print (c)
a=b
b=c
| true |
1fe360424a6ce95e63ccd1fd5ad36e717e4f247f | Python | junyi1997/TQC_Python | /6.第六類/PYD609.py | UTF-8 | 836 | 4.09375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 7 20:16:31 2018
@author: user
矩陣相加
"""
a=[]
b=[]
print("Enter matrix 1:")
for i in range(2):
a.append([])
for j in range(2):
print("[%d, %d]: " % (i+1, j+1), end = '')
a[i].append(int(input()))
print("Enter matrix 2:")
for i in range(2)... | true |
877533d0bb6c593fc14002aa3680eead79fe6f47 | Python | gjkapral/StackOverflowSurveyAnalysis | /AnalysisOfStackOverflowSurveys.py | UTF-8 | 8,077 | 2.59375 | 3 | [] | no_license | import os
import pandas as pd
from collections import defaultdict
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score, mean_squared_error
import seaborn as sns
import test as t
os.chdir("C:\\Users\\Nice... | true |
5be13f97643c6bf412d2eb880972f1be2465040f | Python | SejalChourasia/python-assignment | /python assignment11/Module4/Question-03/sortword.py | UTF-8 | 75 | 3.109375 | 3 | [] | no_license | s=input('Enter Any Sentence').split(' ')
print(' '.join(sorted(set(s))))
| true |
bb9b9612104edc842e111031cb11fc49f6110cb7 | Python | AaronGe88inTHU/pyMaterialTestsProcess | /ExperimentProcess/Mat252/a2Star.py | UTF-8 | 112 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
def a2Star(poisonStar):
return (1-2*poisonStar)/2 /(1+poisonStar)
print(a2Star(0.346))
| true |
cecc72c2f0cecbde45b9529986a707fe15a1e4a8 | Python | Tusho-zica/Tusho | /Lets_code/Lógica_de_programação_orientada_a_objetos/Aula_3/Lista 2 - For/ex10.py | UTF-8 | 606 | 4.15625 | 4 | [] | no_license | # 10. Pegue a lista gerada no exercício anterior e transforme cada um dos
# itens dessa lista em um float.
# OBS: Não é para alterar o programa anterior, mas sim a lista gerada
# por ele.
num0 = input("Digite o primeiro número da lista: ")
num1 = input("Digite o primeiro número da lista: ")
num2 = input("Digite... | true |
dea208a8f9d8c9fba735cf427636da8b878e7e9a | Python | SukyoungCho/Programming | /Python/readcsv_hw.py | UTF-8 | 2,612 | 4.125 | 4 | [] | no_license | import csv
def read_csv(path):
""" return a list of the rows from the CSV file at the specified path
in the list-of-dictionaries with their column headers as keys, and numbers as floats.
read any CSV. If the file does not exist, return None.
Try, except should catch both ValueError raised by type conve... | true |
d7c779b6b8322da88981f27985554bb677f59532 | Python | inkyu0103/BOJ | /two pointer/2470.py | UTF-8 | 660 | 3.125 | 3 | [] | no_license | # 2470
import sys
input = sys.stdin.readline
def sol():
num = int(input())
arr = list(map(int,input().split()))
arr.sort()
left,right = 0,num-1
answer = [sys.maxsize,sys.maxsize]
while(left<right):
val = arr[left]+ arr[right]
if val==0:
answer = [arr[left],arr[right]... | true |
225199a23de34536c938f25c02a44e39c0b2798d | Python | alito/deep_q_rl | /deep_q_rl/test/test_q_network.py | UTF-8 | 7,898 | 3.40625 | 3 | [
"BSD-3-Clause"
] | permissive | """
Author: Nathan Sprague
"""
import numpy as np
import theano
import unittest
import numpy.testing
import lasagne
import deep_q_rl.q_network as q_network
class ChainMDP(object):
"""Simple markov chain style MDP. Three "rooms" and one absorbing
state. States are encoded for the q_network as arrays with
... | true |
cd54cebfa3acb65e107e141c198f3aecf8c9c6ab | Python | stinisson/acoustic-eavesdropping | /audio_to_spectrum.py | UTF-8 | 7,518 | 2.9375 | 3 | [] | no_license | import math
import numpy as np
import matplotlib.pyplot as plt
import scipy
from scipy import signal
from scipy.io import wavfile
import pandas as pd
FILENAME = 'f/2021_05_11_160157.429405'
def find_keystrokes_in_amplitude(samples, sample_rate):
# Find all key downs
# Might also find some key ups, will be f... | true |
9ed4c7f9cb4b45822fc0e12bc0003828607bfd32 | Python | sirken/coding-practice | /codewars/8 kyu/is-he-gonna-survive.py | UTF-8 | 905 | 3.953125 | 4 | [
"MIT"
] | permissive | from Test import Test, Test as test
'''
A hero is on his way to the castle to complete his mission. However, he's been told that the castle is surrounded with a couple of powerful dragons! each dragon takes 2 bullets to be defeated, our hero has no idea how many bullets he should carry.. Assuming he's gonna grab a spe... | true |
d79f83933124dffce26f51ae0f325c71ad5a8761 | Python | yunmango/save_file | /np_arr_to_bin.py | UTF-8 | 387 | 2.890625 | 3 | [] | no_license | import numpy as np
# create lidar points x,y,z,intensity
points = np.random.randn(20000,4).astype(np.float32)
print(points)
print(points.shape) # (20000, 4)
# Save lidar points
points.tofile('points.bin')
# TEST
# load lidar binary file
lidar_file = 'points.bin'
load_points = np.fromfile(lidar_file, dtype=np.f... | true |
fa446811f4a0a1c59d35a2a196c9a8fbf5cbd5f9 | Python | iamsrsohag/MachineLearning | /incomePerCapita/CanadaIncomePerCapita.py | UTF-8 | 498 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
df = pd.read_csv("canada_income.csv")
df
get_ipython().run_line_magic('matplotlib', 'inline')
plt.xlabel("Year")
plt.ylabel("Salary Per Capita")
plt.scatter(df.year,df.income, ... | true |
7d6e1f6e1c874ed540a3167a2018ad08efbe4154 | Python | belminf/kaslan | /kaslan/commands/destroy.py | UTF-8 | 719 | 2.6875 | 3 | [] | no_license | from kaslan.commands import get_vmware
def cli_setup(subparsers, config):
# Destroy parser
parser = subparsers.add_parser('destroy', help='Delete a VM')
parser.set_defaults(func=func)
# Destroy: arguments
parser_args = parser.add_argument_group('destroy arguments')
parser_args.add_argument('... | true |
cde67a7a4f5532c1ebe312b69ef8f38b65107013 | Python | kokorinosoba/contests | /AOJ/ITP2/python/ITP2_1_D_Vector_II.py | UTF-8 | 324 | 2.71875 | 3 | [] | no_license | from collections import deque
n, q = map(int, input().split())
A = [deque() for _ in range(n)]
for _ in range(q):
query = list(map(int, input().split()))
if query[0] == 0:
A[query[1]].append(query[2])
elif query[0] == 1:
print(*A[query[1]])
elif query[0] == 2:
A[query[1]] = deq... | true |
7d383e7c10236766099430b626b0729fe3fc5bc9 | Python | DigitalResearchCentre/RdfViewer | /rdfviewer/db.py | UTF-8 | 2,743 | 2.609375 | 3 | [] | no_license | import urllib, urllib2, settings
from lxml import etree
from rdflib.term import URIRef, BNode, Literal
class SPARQLResultParseError(Exception):
pass
class SPARQLResult(dict):
namespaces = {'ns':'http://www.w3.org/2005/sparql-results#'}
def __init__(self, element):
binding_type = {
'ur... | true |
8f3becaf23cf9adee027e64f4a500945cb1fa203 | Python | bernest/modulo-django-desarrollo-web-cdmx-20-05pt | /sesion_06/movies/models.py | UTF-8 | 758 | 3.15625 | 3 | [
"MIT"
] | permissive | """Movies app models"""
from django.db import models
class Director(models.Model):
"""Director model"""
first_name = models.CharField('nombre(s)', max_length=100)
last_name = models.CharField('apellido(s)', max_length=100)
birthday = models.DateField('cumpleaños')
def __str__(self):
"""R... | true |
59e118c7dcb6b8b6ba205483a8aea95756de88d7 | Python | PyThaiNLP/pythainlp | /pythainlp/tag/pos_tag.py | UTF-8 | 7,618 | 2.890625 | 3 | [
"Apache-2.0",
"CC0-1.0",
"LicenseRef-scancode-public-domain",
"CC-BY-4.0"
] | permissive | # -*- coding: utf-8 -*-
# Copyright (C) 2016-2023 PyThaiNLP Project
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | true |
1c6f15adf377291c1bee6af05e9bd85a9dcc33a4 | Python | soniloi/dicey | /src/predict.py | UTF-8 | 837 | 2.53125 | 3 | [] | no_license | import sys
import numpy
import PIL
import tensorflow
import tensorflow_hub
CLASSES = ["d4", "d6", "d8", "d10", "d12", "d20"]
IMAGE_SIZE = 150
if __name__ == "__main__":
model_filename = sys.argv[1]
image_filename = sys.argv[2]
model = tensorflow.keras.models.load_model(
model_filename,
c... | true |
1c8c2d23934765adccd5453acf1e503631818ca6 | Python | CCCQ2/python-open-controls | /qctrlopencontrols/dynamic_decoupling_sequences/predefined.py | UTF-8 | 40,189 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2021 Q-CTRL
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | true |
0e1b54c06fdfe560f8e5ea68e4ce66b1d7053cd0 | Python | alangenfeld/flock | /analysis/parsechat.py | UTF-8 | 526 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
import frequency
def parseFrequencies(msg,wordDict):
for word in msg.lower().split():
if word in wordDict:
wordDict[word] = wordDict[word] + 1
else:
wordDict[word] = 1
for key in wordDict.keys():
wordDict[key] = wordDict[key] * frequency.frequency(key)
return wordDict
#test...
#newD... | true |
e1a4cd4ced394c642cafc91f10190454f2206697 | Python | jonathandu001/myproject1 | /name1.py | UTF-8 | 158 | 4 | 4 | [] | no_license | # 获取用户输入的名称,然后打印出来
#从键盘输入
name = input('你叫什么名字:')
# 打印名称
print ('你的名字是:',name) | true |
56abe9ec6ba7e9b9fffd488aab36ebe53ff6280b | Python | aduV24/python_tasks | /Task 15/game/game.py | UTF-8 | 5,829 | 3.890625 | 4 | [] | no_license | # This is a python game program built with the pygame library and its modules
# It contains one player object and three enemy objects. If there's a
# Collision between the player and any enemy object the player loses
# Else the player wins.
import pygame
import random
#Initialise screen w
pygame.init()
screen_width ... | true |
cf12631cacb9f31e441812fd7b407c42048dcf45 | Python | Taeseven/Proper-Name-Newsgroup-Classification | /maximum_entropy.py | UTF-8 | 3,891 | 3.265625 | 3 | [] | no_license | """ Maximum entropy model for Assignment 1: Starter code.
You can change this code however you like. This is just for inspiration.
"""
import os
import sys
import numpy as np
from scipy.optimize import fmin_l_bfgs_b as F
from util import evaluate, load_data
class MaximumEntropyModel():
""" Maximum entropy model... | true |
654bc81fa3d26acfdd70ac1a5b3d8963a30d58e6 | Python | rjmeats/AWS-Trials | /AWSTrials/Python/sqstest2/add_messages_to_queue.py | UTF-8 | 1,509 | 2.59375 | 3 | [] | no_license | # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html
import boto3
import list_queues as lq
sqs = boto3.resource('sqs')
def add_messages(qname, count) :
q = sqs.get_queue_by_name(QueueName=qname)
print()
print("Adding", count, "message" if count == 1 else "messages", " to queue",... | true |
e3f00d26b5d138c5ae9fd691ac852abf47f96363 | Python | ahmadturkmani/CPSC231 | /Apocalypse_Pirates/Apocalypse_Wk5(Fixed).py | UTF-8 | 3,787 | 3.90625 | 4 | [
"MIT"
] | permissive | #This program is the 5th week submission for Tutorial 2 Group 5's game apocalypse
#Setting Variables
name='pawn'
column=ord('a')
row=1
color='white'
x=0
y=0
def show_title():#Printing initialziation - intro screen
print('###################################################')
print('# # ### #=# ... | true |
0a5fc3dd5c87a45712cc92bbb5b5ab46fe018ba3 | Python | AlvaroManso/Python | /Courses/Mastermind/practice/venv/for.py | UTF-8 | 286 | 3.625 | 4 | [] | no_license | vocales = ["u", "a","i","e", "o"]
frase = "estoy estudiando uwu"
vocales_encontradas = 0
for letra in frase:
if letra in vocales:
print("he encontrado {}".format(letra))
vocales_encontradas += 1
print("vocales encontradas: {}".format(vocales_encontradas)) | true |
adc424e32166d9b29c175ba536f9839425635699 | Python | mabrenu/phyton_basico_2_2019 | /Practica1/Practica#3.py | UTF-8 | 458 | 4.03125 | 4 | [] | no_license | #Revisar los tipos de datos
#num entero
1233122 #no se ocupa redefinir el tipo.
#almacenar la variable
mi_variable = 155
#caso#1 '' excepto '
print('mi "variable" ',mi_variable)
#caso#2 "" excepto "
print("mi 'variable'",mi_variable)
#caso#3 '', señalas \'
# no funciona print('mi \'variable\'',mi_variable)
#... | true |
a2c7dda9d480c2ed46fa60c27415b55f2b351a65 | Python | Dsbaule/INE5452 | /Simulado 02/EscalonadorDeProcessos/tests/tester.py | UTF-8 | 4,325 | 3.375 | 3 | [
"Apache-2.0"
] | permissive | """
Autor: Daniel de Souza Baulé (16200639)
Disciplina: INE5452 - Topicos Especiais em Algoritmos II
Atividade: Segundo simulado - Questoes extra-URI
Escalonador de Processos - Versão para teste com impressão das EDs
"""
from src.EscalonadorDeProcessos.MaxHeap import MaxHeap
from src.EscalonadorDeProcessos.Processo... | true |
97c437aa23ec33fd267dda0555676cff5596ef63 | Python | DomBennett/Project-cluster | /stages/count.py | UTF-8 | 466 | 2.640625 | 3 | [] | no_license | #! /bin/usr/env python
# D.J. Bennett
'''
Count clusters from cdhit
'''
def count(clfl, min_nsqs=10):
'''
Count number of clusters
'''
lines = []
with open(clfl, "rU") as infile:
for line in infile:
lines.append(line)
nsqs = 0
ncls = 0
for line in lines:
if l... | true |
e118bff87cf9dc18fbd65ae712c165f511d71eda | Python | yuechuanx/fluent-python-code-and-notes | /19-dyn-attr-prop/oscon/osconfeed.py | UTF-8 | 1,220 | 2.78125 | 3 | [
"MIT"
] | permissive | """
osconfeed.py: Script to download the OSCON schedule feed
# BEGIN OSCONFEED_DEMO
>>> feed = load() # <1>
>>> sorted(feed['Schedule'].keys()) # <2>
['conferences', 'events', 'speakers', 'venues']
>>> for key, value in sorted(feed['Schedule'].items()):
... print('{:3} {}'.format(len(value),... | true |