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 |
|---|---|---|---|---|---|---|---|---|---|---|
a880e912d2068f2cdf4249dcd2e771c7998f1b7c | lovehhf/LeetCode | /contest/第 183 场周赛/1403. 非递增顺序的最小子序列.py | UTF-8 | 1,864 | 3.96875 | 4 | [] | no_license | # -*- coding:utf-8 -*-
"""
给你一个数组 nums,请你从中抽取一个子序列,满足该子序列的元素之和 严格 大于未包含在该子序列中的各元素之和。
如果存在多个解决方案,只需返回 长度最小 的子序列。如果仍然有多个解决方案,则返回 元素之和最大 的子序列。
与子数组不同的地方在于,「数组的子序列」不强调元素在原数组中的连续性,也就是说,它可以通过从数组中分离一些(也可能不分离)元素得到。
注意,题目数据保证满足所有约束条件的解决方案是 唯一 的。同时,返回的答案应当按 非递增顺序 排列。
示例 1:
输入:nums = [4,3,10,9,8]
输出:[10,9]
解释:子序列 [10,9] 和 [10,8... | true |
f38e98530354681b79457cffa1ffc5fabc871645 | WangZh999/Graduation | /project - 副本/src/environment_selection.py | UTF-8 | 1,090 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # encoding: utf-8
import numpy as np
from crowding_distance import crowding_distance
from nd_sort import nd_sort
def environment_selection(pop_dec, pop_obj, n):
"""
:param pop_dec:decision of population
:param pop_obj:objective of population
:param n:num of offspring
:return:
"""
pop_num... | true |
2afc0143e9e0722825f895df909b6bf8bf3202c1 | JayedHoshen/python-practic | /laptop/4thRevesion/evnOd.py | UTF-8 | 184 | 4.21875 | 4 | [] | no_license | number = input("Please enter an integer number:")
number = int(number)
if number % 2 == 0:
print(number,"is Even Number.")
else:
print(number,"is Odd Number.")
print("Done!")
| true |
b8a0deb146c13b411795d930bad67d5e64fe48ab | kevinbk11/Auto_Parkinglot | /SevenSegmentsClass.py | UTF-8 | 688 | 2.71875 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
class seg():
def __init__(self,D,C,B,A):
self.__Pin=[D,C,B,A]
self.__StateTable=[
[0,0,0,0],
[0,0,0,1],
[0,0,1,0],
[0,0,1,1],
[0,1,0,0],
[0,1,0,1],
[0,1,1,0],
[0,1,1,1]... | true |
52778c6bd107a6c78ca35f47a547e4d55d542b87 | ronaldogomes96/Acelera-Dev-DataScience | /Modulo 2/streamLitApp.py | UTF-8 | 1,311 | 3.25 | 3 | [
"MIT"
] | permissive |
import streamlit as st
def main():
st.title("Hello World") #Titulo
st.header("This is a header")
st.subheader("Isso é uma subheader")
st.text("Isso é um texto")
#st.image("Nome da imagem")
#st.audio("nome do audio")
#st.video("nome do video")
def comandosDeInterface():
#crian... | true |
50df61ee844833634ada5c0f590be247bcf84f2c | sin90lzc/python | /tmp/test.py | UTF-8 | 89 | 3 | 3 | [] | no_license | #!/usr/bin/python
def func():
return (1,2)
(a,b)=func()
print "a=%d,b=%d" % (a,b)
| true |
fa3d8764c4dcd7fa5ef924fc56c96f1e86c12846 | mjenrungrot/AdventOfCode2020 | /1.py | UTF-8 | 950 | 2.890625 | 3 | [
"MIT"
] | permissive | import sys
def extra():
fp = open("1.input")
nums = list(map(lambda x: int(x.strip()), fp.readlines()))
ans = None
for i, num_i in enumerate(nums):
for j in range(i + 1, len(nums)):
for k in range(j + 1, len(nums)):
if num_i + nums[j] + nums[k] == 2020:
... | true |
f8bb93b2b07703d44e56c12dee53f928a02cf114 | Luis-Filho/Uri-codes | /1168 - LED.py | UTF-8 | 176 | 3.265625 | 3 | [] | no_license | A = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
n = int(input())
while n:
total = 0
n -= 1
for i in input():
total += (A[int(i)])
print("{} leds".format(total))
| true |
6cd567fd2b6ad61dc099bd84f90606db0ea7716b | raywo/raspi-plays | /modules_test.py | UTF-8 | 1,235 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import leds.breathing as breathing
from classes.RotaryEncoder import RotaryEncoder
from classes.FlowingLEDs import FlowingLEDs
from classes.ShiftRegister595 import ShiftRegister595
delay = 0.3
stepping = 0.005 # 0.1
def flow():
global flowing_leds
shift_register... | true |
3a00b738b39fc4c08feae5880a32d5970f53e6bd | abbyswag/Helios | /src/lumpedElement.py | UTF-8 | 1,525 | 3.25 | 3 | [
"MIT"
] | permissive | """ Lumped Element Abstraction """
import numpy as np
class LumpedElement:
def __init__(self,n):
self.terminalCount = n
# setting initial current and potential difference to zero
complexZeros = [complex(0) for _ in range(n*n)]
self.potentialDiff = np.array(complexZeros).reshape(n,n... | true |
be7b3720f16b039293d720c82528535eae652dca | Jhon-Chen/Code_Practice | /F_flask/Part1_程序的基本结构/demo1_初始化.py | UTF-8 | 402 | 2.640625 | 3 | [] | no_license | # 所有Flask程序都必须创建一个程序实例
# Web服务器使用(Web Server Gateway Interface, WSGI)协议
# 程序实例是Flask类的对象,一般使用一下代码创建
from flask import Flask
# Flask类的构造函数只有一个必须指定的参数, 即程序主模块或者包的名字,在大多数程序中,Python的__name__变量就是所需的值
app = Flask(__name__)
| true |
500ec192d25b7a8c70ca751acd1c56b0630fa18c | b3ntuz1/words | /examples/telebot.py | UTF-8 | 1,563 | 2.640625 | 3 | [
"MIT"
] | permissive | import flask
import telebot
import words
from dotenv import load_dotenv
load_dotenv()
app = flask.Flask(__name__)
bot = telebot.TeleBot(environ.get("TG_TOKEN"), threaded=False)
WEBHOOK_URL_PATH = "/%s/" % (environ.get("TG_TOKEN"))
# # Remove webhook, it fails sometimes the set if there is a previous webhook
# bot.re... | true |
f908aa0a7cc168dc9fdb1ca875219969f85fcce5 | IDAES/idaes-pse | /idaes/apps/uncertainty_propagation/examples/simple_opt_problem.py | UTF-8 | 8,735 | 3.21875 | 3 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES).
#
# Copyright (c) 2018-2023 by the software own... | true |
3e6366596803849973fbff0d59408d2f5e6772cb | xristo01/Data_Engineering_Project | /HristoScraper/src/scraper/__main__.py | UTF-8 | 318 | 2.765625 | 3 | [
"MIT"
] | permissive | import pandas as pd
from .scraping import CarScraping
if __name__ == "__main__":
scraping = CarScraping()
giant_df = scraping.car_giant_scraper(50)
big_motor_df = scraping.big_motoring_scraper(77)
main_df = pd.concat([giant_df, big_motor_df], ignore_index=True)
main_df.to_csv('scraped_data.csv') | true |
d55209751d39d5534e5653877c51f0ac118e8ad3 | PioFro/booleanNetworks | /booleanNetwork.py | UTF-8 | 2,448 | 3.09375 | 3 | [] | no_license | import pygame
import random
import time
class Params:
rules={}
size = 10
screen = pygame.display.set_mode((2500, 1000))
id = 0
network = []
numCon = 3
nSize = 1000/size
curXPoint = 0
@staticmethod
def GetRect():
for n in Params.network:
if n.Value == 1:
... | true |
339581f9013da8894a590c4928a4b0240d66e10d | seenigel/python-datestamper | /datestamp.py | UTF-8 | 705 | 2.765625 | 3 | [] | no_license | import shutil
from datetime import datetime
import argparse
date = datetime.strftime(datetime.now(), '%Y%m%d')
parser = argparse.ArgumentParser(description='Back up a log file with a timestmap')
parser.add_argument('-in', '--fileName', type=str, required=True, help='Name of input file')
parser.add_argument('-out','-... | true |
46c6ef301df9bcbb2b90eaceb699a0f5e8ef2f15 | PdxCodeGuild/class_emu | /Code/Kevin/Lab11Version1.py | UTF-8 | 1,383 | 4.125 | 4 | [] | no_license | number_one = 0
number_two = 0
while True:
operand = input("What is the operand we're working with? You can enter '+', '-', '/', '*' :\n")
if operand == "+":
number_one = int(input("Enter the first number to add: \n"))
number_two = int(input("Second number: \n"))
print(f"Answer: {number_o... | true |
a86d262f35504dcb246d40eb8ca868971cc2925e | jmzaleski/dcs-grade-file-scripts | /record_mark_section.py | UTF-8 | 5,809 | 3.234375 | 3 | [] | no_license | #!/usr/bin/python
# port install python35 +readline
# else readline acts very strangely around prompts.
"""
knows how to handle my 2016 fall CDF empty grades files built from the new classlists that contain all sorts of useful data
"""
from __future__ import print_function #allows print as function
import sys,os, r... | true |
16d451ba53d548de223f7627a9ea70171c53cc77 | surajiitd/Computer-Vision-COL780 | /Assignment1/test.py | UTF-8 | 510 | 3.3125 | 3 | [] | no_license | def add(arr1,arr2):
n,m = len(arr1),len(arr1[0])
arr3 = [[0 for x in range(m)] for x in range(n)]
for i in range(n):
for j in range(m):
arr3[i][j] = arr1[i][j] + arr2[i][j]
return arr3
def sub(arr1,arr2):
n,m = len(arr1),len(arr1[0])
arr3 = [[0 for x in range(m)] for x in range(n)]
for i in range(n):
for ... | true |
bd92e5480930d88a60ec3b8de93c1a033b8814c4 | majpyi/enhanceEdge | /outBDPic.py | UTF-8 | 741 | 2.515625 | 3 | [] | no_license | import numpy as np
import cv2
inpath = "D:\\out\\"
outpath = "D:\\out\\"
gradient = np.loadtxt(inpath + "bd.csv", dtype=np.int, delimiter=",", encoding='utf-8')
print(type(gradient))
print(gradient)
for i in range(gradient.shape[0]):
for j in range(gradient.shape[1]):
# print(gradient[i, j])
# print(type(gradien... | true |
ff96916a44c88d628ec8a90c1170905fd9379d20 | johannvk/TMA4220-Projects | /root/project_2/elasticity_solver.py | UTF-8 | 39,682 | 2.796875 | 3 | [] | no_license | import numpy as np
import scipy.linalg as la
import scipy.sparse as sp
import scipy.sparse.linalg as spla
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.tri as mtri
from matplotlib.animation import ArtistAnimation
from mpl_toolkits.mplot3d import axes3d
from itertools import product as ite... | true |
3b75373b83c50188380e3479fa6e9d8b80be35b3 | Pandinosaurus/nnabla | /python/src/nnabla/models/semantic_segmentation/utils.py | UTF-8 | 4,356 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#
# Un... | true |
8d14343dd42da5b0d9f0fc767465f9fb41b45b7f | mortimer2015/learnpython | /函数/typed.py | UTF-8 | 664 | 2.84375 | 3 | [] | no_license | import inspect
from functools import wraps
def typed(fn):
@wraps(fn)
def wrap(*args, **kwarges):
for i, param in enumerate(inspect.signature(fn).parameters.values()):
if param.annotation:
if param.name in kwarges.keys():
if not isinstance(kwarges[param.n... | true |
c4105bde563cbcbb54e1ac8604a7b0f40f25d7bd | jeisenma/ProgrammingConcepts | /07-animation/recordedMotion.pyde | UTF-8 | 1,132 | 3.21875 | 3 | [] | no_license | # J Eisenmann 2013
# jeisenma@accad.osu.edu
# animation properties
rad = 30
recording = False
f = 0
numFrames = 800
motion = []
def setup():
size(400,400)
strokeWeight(2)
global pos
pos = PVector(width/2,height-rad)
# fill keyframes with starting position
for i in range(numFrames):
... | true |
a65de50b2d7a31c5984a5bcdb62445c6f2f4abcb | gema0000/kerasStudy | /파이썬라이브러리를활용한머신러닝 20181117/p370_GridSearchCV.py | UTF-8 | 1,484 | 3.171875 | 3 | [] | no_license |
from sklearn.svm import SVC
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler, StandardScaler
# 데이터 적재와 분할
cancer = load_breast_cancer()
X_train, X_test, y_train, y_test = train_test_split(
cancer.data, cancer.target... | true |
62d9155a7f4f051e160986cbaaa73bea03d56791 | Troy517545/DL-project | /ckeckSimilarity.py | UTF-8 | 8,844 | 2.640625 | 3 | [] | no_license | import os
import torch
device = torch.device("cuda:0")
from data_loader import TreeDataset, ImgDataset
tree_train = TreeDataset(tree_dir=os.path.join('bin', 'tree_train'), device=device)
img_train = ImgDataset(img_dir=os.path.join('bin', 'img_train'), device=device)
tree_eval = TreeDataset(tree_dir=os.pat... | true |
82a796cf455131b76d6f7b6d677a4d6aacd5910c | AnanduR32/PythonProgrammingBasics | /p26(multiplication table).py | UTF-8 | 174 | 3.734375 | 4 | [
"MIT"
] | permissive | n=int(input("Enter number whose multiples you want to find"))
i=1
j=int(input("The number of multiples"))
while(i<=j):
m=n*i
print(n,"x",i,"=",m)
i=i+1
| true |
08a4a25009d28dc657797a50f983557beb974412 | astrotutor9/Neopixels-Microbit-and-Python | /changing_colours.py | UTF-8 | 428 | 3.15625 | 3 | [] | no_license | from microbit import *
import neopixel
ring = neopixel.NeoPixel(pin0, 16)
# set some variables for colours
red = (75, 0, 0)
green = (0, 75, 0)
blue = (0, 0, 75)
# create a list of colours to be read as use_this_colour
colours = [red, green, blue]
while True:
for use_this_colour in colours:
for next_led ... | true |
6ca04b6224212bf3fd52f6a81f1b2b8eba682fb3 | Code-Institute-Submissions/recipe_me | /helpers.py | UTF-8 | 460 | 3.6875 | 4 | [] | no_license | def create_list(x):
""" function to create a list """
return x.split('.')
def make_comparison(ad_equip, display_equip):
""" function that checks if one item of a list is in another,
if it is return True """
lower_case_ad_equip = [x.lower() for x in ad_equip]
lower_case_display_equip = [y... | true |
1eabb8a028c43398d48ea9dca7e77749a93484ce | Aasthaengg/IBMdataset | /Python_codes/p03362/s833739831.py | UTF-8 | 207 | 2.765625 | 3 | [] | no_license | n = int(input())
P, A = [2], [2]
for i in range(3, 55556, 2):
for p in P:
if i % p == 0: break
else:
P.append(i)
if i % 5 == 2: A.append(i)
if len(A) == n: break
print(*A) | true |
dbcd37447255ac464f3ab1c70ed7ef1653943ef7 | Weless/leetcode | /python/general/974. 和可被 K 整除的子数组.py | UTF-8 | 503 | 3.109375 | 3 | [] | no_license | from typing import List
class Solution:
def subarraysDivByK(self, A: List[int], K: int) -> int:
i = 0
count = 0
p = [0 for _ in range(len(A))]
while i < len(A):
j = i + 1
p[0] = A[i]
while j <= len(A):
p[j] = A[j] + p[j-1]
... | true |
e5fa4f2d7a1eb21d5a09edde91df5aaddcd6cb1b | Geoffrey-Kong/CCC-Solutions | /'05/Junior/CCC '05 J1 - The Cell Sell.py | UTF-8 | 718 | 3.765625 | 4 | [] | no_license | a = int(input())
b = int(input())
c = int(input())
daycostA = (a - 100) * 0.25
if daycostA < 0:
daycostA = 0
eveningcostA = b * 0.15
weekendcostA = c * 0.2
daycostB = (a - 250) * 0.45
if daycostB < 0:
daycostB = 0
eveningcostB = b * 0.35
weekendcostB = c * 0.25
costplanA = daycostA + eveningcostA + weeke... | true |
f7895d1aff0162ccabc7033109d5fc0aefaeaece | virajs/codeeval | /2-hard/skyscrapers/main.py | UTF-8 | 977 | 3.234375 | 3 | [
"Unlicense"
] | permissive | import sys
import re
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
test = test.strip()
if len(test) == 0:
continue
heights = {}
def note_height(index, ma):
if index in heights:
heights[index] = max(heights[index], ma)
else:
heights[index] ... | true |
e51d33684c148de764d6264d47a5f9be114b27f4 | mwasjos/osgeopy-code | /Chapter5/section5.2.py | UTF-8 | 6,690 | 2.890625 | 3 | [
"MIT"
] | permissive | import os
import sys
from osgeo import ogr
import ospybook as pb
# Set this variable to your osgeopy-data directory so that the following
# examples will work without editing. We'll use the os.path.join() function
# to combine this directory and the filenames to make a complete path. Of
# course, you can type the fu... | true |
85d34e752f8aab2bd5a14ef74652b9b2d7930708 | swipswaps/Voice-Cloning-App | /synthesis/synonyms.py | UTF-8 | 928 | 3.296875 | 3 | [
"BSD-3-Clause"
] | permissive | import nltk
nltk.download("wordnet")
from nltk.corpus import wordnet
def get_synonyms(word):
"""
Generates a list of synonyms for a word.
Parameters
----------
word : str
Word to find synonyms of
Returns
-------
list
List of synonyms
"""
synonyms = set()
... | true |
41d7339227e8694b7d98ec89c15ef499e76cd379 | AdemHodzic/python-learning | /Day #28/test_insert.py | UTF-8 | 745 | 3.0625 | 3 | [] | no_license | import unittest
from insert import solution
class InsertTest(unittest.TestCase):
def test_first(self):
input = [[1,3,5,6], 5]
output = 2
result = solution(*input)
self.assertEqual(result, output)
def test_second(self):
input = [[1,3,5,6], 2]
output = 1
... | true |
ce89554e6c4aee85bb70e6ea62e5416ede526381 | zhanjw/leetcode | /codes_auto/43.multiply-strings.py | UTF-8 | 1,258 | 3.328125 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=43 lang=python
#
# [43] multiply-strings
#
class Solution(object):
def multiply(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
results = []
for i in range(len(num1)+len(num2)):
results.append(0)
for i in range(len(num1)-1,-1,-1... | true |
7114a4d21e40c4dafe7682bc732c623425c2789f | buianhduc/C4T-B10 | /game/dungeonLV1.py | UTF-8 | 2,826 | 3.328125 | 3 | [] | no_license | import os, random
Map = [
['-','-','-','-',],
['-','-','-','-',],
['-','-','-','-',],
['-','-','-','-',]
]
class condinate:
def __init__(self, x, y):
self.x = x
self.y = y
Door = condinate(0,0)
Key = condinate(0,0)
Player = condinate(0,0)
Wall = condinate(0,0)
def same(condinates):... | true |
d2b90c285b76beec896225811ef41fabc0605974 | Yancey1989/models | /tests/base.py | UTF-8 | 1,162 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import unittest
import tensorflow as tf
def train_input_fn(features, labels, batch_size=32):
dataset = tf.data.Dataset.from_tensor_slices((dict(features), labels))
dataset = dataset.shuffle(1000).repeat().batch(batch_size)
return dataset
def eval_input_fn(features, labels, batch_size=32):
dataset = tf... | true |
8e40c9d5b0f8e5767ad86e6ccdb5747774e1a431 | jweir136/p2p-ftp | /ftp/client.py | UTF-8 | 202 | 2.546875 | 3 | [] | no_license | import requests
import os
# ip = REST-ADDR/FILENAME
def download(ip):
filename = ip.split("/")[-1]
with open(os.path.join("assets", filename), "w+") as f:
f.write(requests.get(ip).text) | true |
b9182a2ea50776c17f74ad788fd38770b4b6cdfb | FishingMapache/Machine-Learning-CS6303 | /Imdb_labelled_Data.py | UTF-8 | 1,396 | 3.078125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn import metrics
if __name__ == "__main__":
# Import data and split
data = pd.read_... | true |
a722f69e1d661c26055a97d256fbc37f97dae0b2 | owid/co2-data | /scripts/upload_datasets_to_s3.py | UTF-8 | 1,943 | 2.796875 | 3 | [
"CC-BY-4.0"
] | permissive | """Upload OWID CO2 dataset files to S3 and make them publicly available.
This script requires OWID credentials to write files in the S3 bucket.
Files should be accessible at the following urls:
* https://nyc3.digitaloceanspaces.com/owid-public/data/co2/owid-co2-data.csv
* https://nyc3.digitaloceanspaces.com/owid-publ... | true |
1b46bc5d19282ac2adc26352fb0fec0eed8bb8e4 | edderick/euler | /problem5.py | UTF-8 | 283 | 3.65625 | 4 | [] | no_license | top = 20
x = 1
for i in range(1, top + 1):
x *= i
def divides_by_all(x, top):
for i in range(1, top + 1):
if x % i != 0:
return False
return True
for i in reversed(range(2, top + 1)):
if divides_by_all(x / i, top):
x = x / i
print x
| true |
83ff65c0d06b4326ed633a59664e40f795866d29 | rohitandcode/LC_Medium | /encode_decode_tinyurl.py | UTF-8 | 889 | 3.390625 | 3 | [] | no_license | class Codec:
def __init__(self):
self.dicto = {}
def encode(self, longUrl):
"""Encodes a URL to a shortened URL.
:type longUrl: str
:rtype: str
"""
v = 0
v += 1
if longUrl not in self.dicto.values():
self.dicto[v] = lo... | true |
a924ca4cf2925ebd7d16fd91702cd042b4c3b36a | dmcinerney/pytt | /pytt/progress_bar.py | UTF-8 | 733 | 2.59375 | 3 | [] | no_license | from tqdm import tqdm
from pytt.distributed import log_bool
from pytt.logger import logger
class ProgressBar:
def __init__(self):
self.pbar = None
def enter(self, *args, **kwargs):
if log_bool():
self.pbar = self.init_pbar(*args, **kwargs)
logger.add_progress_bar(tqdm)
... | true |
6ff81b8ca605b137e8987094c230560737605212 | dezgeg/pyTTK | /tests/binary_loader_test.py | UTF-8 | 1,981 | 2.671875 | 3 | [] | no_license | import unittest
from nose.tools import eq_, ok_
from StringIO import StringIO
from pyttk.loader.binary_loader import load_binary_file, BinaryLoader
class BinaryLoaderSuccesfulLoadTests(unittest.TestCase):
def setUp(self):
self.program = load_binary_file('test file', StringIO(
"""___b91___
___code___
0 1
35651626
... | true |
a60d28c2084a9d8864e21b3becf417972bc6640d | fluette/Movies | /entertainment_center2.py | UTF-8 | 1,982 | 3.203125 | 3 | [] | no_license | import media
import fresh_tomatoes
#movie classes:{title,storyline,poster image}
#movies = [Deja Vu,Inside Man, Training Day,
#American Gangster, Philadelphia, Man on Fire]
#external rendering function: fresh_tomatoes.open_movies_page(movies)
deja_vu = media.Movie("Deja Vu",
"ATF Agent travels back i... | true |
d987bcd038347e6847a09b04b99ea2d73a22acd0 | znsoftm/PaddleOCR2Pytorch | /misc/diff.py | UTF-8 | 520 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
def print_cmp(inp, name=None):
print('{}: shape-{}, sum: {}, mean: {}, max: {}, min: {}'.format(name, inp.shape,
np.sum(inp), np.mean(inp),
np.max(inp), np.mi... | true |
a94cd7245abf21bdbdb8a72f6c4a3382ceb3623b | alecarvalho/alecarvalho | /Primeira_Api/app.py | UTF-8 | 561 | 2.890625 | 3 | [] | no_license | from flask import Flask, jsonify, request
import json
app = Flask(__name__)
@app.route("/<int:id>")
def pessoa(id):
return jsonify({'id': id, 'nome': 'Alessandro', 'profissao': 'Desenvolvedor', 'idade': '44'})
# @app.route('/soma/<int:valor1>/<int:valor2>')
# def soma(valor1, valor2):
# return ({'... | true |
acd59bc95a40d2e316438382769b56b5735e84e2 | Zian-Zhou/MyMachineLearning | /1_数据预处理/1_data_preprocessing_fertures_extraction_decretedata.py | UTF-8 | 6,645 | 3.90625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 6 19:25:01 2018
@author: a
"""
#%%==============特征数据预处理-离散值处理===========
"""
#预读笔记
-关于标签label的处理:(“标签处理”)
如果得到的数据,Y值是分类变量,首先要转换成数值型0,1,2等来表示的话,结合set(),map(dict)实现
set(class_label):class_label有几类,则返回每一类的值
map(dict):dict建立映射,DataFrame通过map函数实现数据转换,如dict={A:1}... | true |
0c6051889e3343030b86df47177ba5a33af084ab | benhills/RadarScripts | /DepthCorrections.py | UTF-8 | 1,749 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 3 16:19:47 2018
@author: benhills
"""
import numpy as np
from PermittivityModels import firnPermittivity
# ----------------------------------------------------------------------------
### Create a function for transfering time to depth
def timeT... | true |
5f7e0785aca584d37ffb22ce238d62a96bcfb216 | dEbAR38/ITMO_ICT_WebDevelopment_2020-2021 | /students/K33402/lr1/Taskfour/client.py | UTF-8 | 1,045 | 3.15625 | 3 | [
"MIT"
] | permissive | import socket
import threading
class Client:
def __init__(self):
self.server = '127.0.0.1', 14900 # Данные сервера
self.sor = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sor.bind(('', 0)) # Задаем сокет как клиент
def read_sok(self):
while 1:
data = sel... | true |
4752bbdd5b22a7d3fa5c84ac1175165098e3abe0 | zjingcong/cg | /final/bazier.py | UTF-8 | 311 | 3.609375 | 4 | [] | no_license | import math
i = 2
n = 4
x = 1 / 4.0
# factorial
n_f = math.factorial(n)
i_f = math.factorial(i)
n_i_f = math.factorial(n-i)
print "n factorial: ", n_f
print "i factorial: ", i_f
print "n-1 factorial: ", n_i_f
f = n_f / (i_f * n_i_f)
print "n, i: ", f
B = f * (x ** i) * ((1 - x) ** (n - i))
print "B: ", B
| true |
98972e1c8aeb579f08a78cc5a778fb4f1421996a | amruthv/MPL | /test/profiler.py | UTF-8 | 689 | 2.6875 | 3 | [] | no_license | def runNTimes(m, n):
times = []
for i in range(n):
a = time.time()
p = multiprocessing.Process(target=m)
p.start()
p.join(120)
# If thread is active
if p.is_alive():
print "m is running... let's kill it..."
# Terminate m
p.termi... | true |
adbb134ccc67fb4dfe104a3bd32c7a3e726ce7d9 | kimjy392/exception | /백준/1806. 부분합.py | UTF-8 | 442 | 2.890625 | 3 | [] | no_license | N, S = map(int, input().split())
numbers = list(map(int, input().split()))
result = len(numbers) + 1
l, r, res, tmp = 0, 0, 0, 0
while 1:
if S <= res:
if result > tmp:
result = tmp
l += 1
res -= numbers[l-1]
tmp -= 1
elif r >= len(numbers):
break
else:
... | true |
7291bf630b6d317f8a6948f59bd37ad5befafcfd | mageshrocky/python_django_projects | /pythoninternprojects/nutri.py | UTF-8 | 1,817 | 3.359375 | 3 | [] | no_license | class A:
def c(self):
curd_rice = {'calories': 130,
'fat': 3.48,
'carbs': 18.07,
'protein': 5.73,
'fibre': 0.8}
def v(self):
veg_biriyani = {'calories': 241,
'fat': 17.9,
... | true |
f2dae7600374d00a882c1f0927571faaee567f3b | FelSiq/machine-learning-learning | /optimization-algorithm-implementation/py-evo-algo-models/first-version/steady-state.py | UTF-8 | 3,963 | 3.796875 | 4 | [] | no_license | """
Based on video
"Vídeo 35 - Computação Evolutiva: Primeiro Modelo"
URL: https://www.youtube.com/watch?v=JE2S74O0t6Y&t=68s
"""
import matplotlib.pyplot as plt
import collections
import numpy as np
import copy
"""
Scheduling problem
"""
class Steady:
"""
Model charactetistics:
- Each generation:
1. ... | true |
5be45b6959f9ad1c9c204c9e4ff9c4309f6d3a22 | Aasthaengg/IBMdataset | /Python_codes/p04044/s186433692.py | UTF-8 | 164 | 2.671875 | 3 | [] | no_license | if __name__ == "__main__":
N, L = map(int,input().split())
di = list()
for i in range(N):
di.append(input())
copy = sorted(di)
ans =''.join(copy)
print(ans) | true |
0d7469544586bea010c1b09fc5e23ced2d04a4da | forrestchang/Schemy | /schemy/eval.py | UTF-8 | 7,743 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Author: Forrest Chang (forrestchang7@gmail.com)
from .procedure import LambdaProcedure, NuProcedure
from .types import *
from .repl import *
from .utils import main, trace
def scheme_eval(expr, env):
"""
Evaluate Scheme expression expr in env. If env is None, simply
returns expr ... | true |
4909c878840f8eee820a2a8e1ff77dd0f394bd73 | calfar22/craterpy | /craterpy/dataset.py | UTF-8 | 10,310 | 3.09375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """Contains the CraterpyDataset object which wraps gdal.Dataset."""
from __future__ import division, print_function, absolute_import
from craterpy.exceptions import DataImportError
import numpy as np
import gdal
import craterpy.helper as ch
gdal.UseExceptions() # configure gdal to use Python exceptions
class Craterp... | true |
cd4b43d83018162375fdfebe93953675c0ef03f9 | jilljenn/vae | /blstm.py | UTF-8 | 5,513 | 2.6875 | 3 | [] | no_license | import tensorflow as tf
import zhusuan as zs
import numpy as np
class BayesianLSTMCell(object):
def __init__(self, num_units, forget_bias=1.0):
self._forget_bias = forget_bias
w_mean = tf.zeros([2 * num_units + 1, 4 * num_units])
self._w = zs.Normal('w', w_mean, std=1., group_ndims=2)
... | true |
ad74c367fb61117a53fd7899b5fa79c78cebbab2 | adastezu/Shortest-Common-Superstring | /verify.py | UTF-8 | 118 | 2.859375 | 3 | [] | no_license | def verifysuperstring(S,x):
n=len(S)
flag=1
for i in range(n):
if not(S[i] in x):
return False
return True
| true |
320845bcdbbfef9be64a99400b889d3191508f65 | zhaoyin214/cv_app | /interface/meta/keypoint.py | UTF-8 | 916 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@file : keypoint.py
@time : 2020/05/25 16:31:41
@author : XiaoY
@version : 1.0
@contact : zhaoyin214@qq.com
@license : (c)copyright XiaoY
@desc : an interface set of keypoints
"""
__author__ = "XiaoY"
from .aggregate import Iterator
from abc ... | true |
4ced819b0cbc77983bf95ba179ad5193a4181a66 | aiqingr/python-lesson | /pythonProject/python1/customFunction.py | UTF-8 | 146 | 3.6875 | 4 | [] | no_license | def calculate_age(year):
age = 2018 -year
return age
user_input = int(input("Enter your birth year: "))
print(calculate_age(user_input))
| true |
0fd3ceda75230831e1531e99c3ff888806b21914 | mohit9638iitk/Halo-Exchange-Simulator | /plot_helper.py | UTF-8 | 2,079 | 2.90625 | 3 | [] | no_license |
# coding: utf-8
# In[3]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sys
# In[18]:
Input=sys.argv[1]
# In[73]:
df=pd.read_csv(Input,names=['Y'])
# In[74]:
df.head()
# In[75]:
temp=np.array(df['Y'])
# In[76]:
len(temp)
# In[77]:
import math
# In[78]:
m... | true |
e37052a5f24175c286920dfea0f136f795060d19 | vanusy/hand-eye-robotics-grasping | /robot_grasp/CNN/cnn_regression_train.py | UTF-8 | 3,118 | 2.828125 | 3 | [] | no_license | '''Train a simple deep CNN on the CIFAR10 small images dataset.
GPU run command:
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python cifar10_cnn.py
It gets down to 0.65 test logloss in 25 epochs, and down to 0.55 after 50 epochs.
(it's still underfitting at that point, though).
Note: the data was... | true |
469a26e90e89a980977a9118f2381cb7128824ac | beckhong/Beck-side-projects | /project1/apps/app.py | UTF-8 | 3,130 | 2.53125 | 3 | [] | no_license | import MySQLdb
from flask import Flask, jsonify
from flask_restful import Resource, Api
apps = Flask(__name__)
api = Api(apps)
connect = MySQLdb.connect(host='127.0.0.1',
user='root')
# connect = MySQLdb.connect(host='127.0.0.1',
# user='root',
# ... | true |
2576ea02e9421d1d8d8347f89f3362064655a60c | chinnappa-pattada/mealmaker | /lib/hw_intf/action_components/stirrer.py | UTF-8 | 668 | 2.921875 | 3 | [] | no_license | """
Stirrer with location in 3D cartesian space
"""
# import Stirrer-Motor class
# define limits of cartesian space for the stirrer
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "../abcs"))
from stir_abc import STIR_ABC
class Stirrer(STIR_ABC):
"""
Stirrer Class
"""
def ... | true |
a261a049f582f22e722ed10d5cffb44a2883e5b5 | hudaoling/hudaoling_20200907 | /Python全栈_老男孩Alex/2-For-While-Input-数据类型-变量/DataType_数据类型.py | UTF-8 | 3,608 | 4.15625 | 4 | [] | no_license | # Author:Winnie Hu
一、数字
2是一个整数的例子
3.23是浮点数的例子
type() #查看数据类型
1.int(整型)
在32位机器上,整数的位数为32位,取值范围-2**31~2*31-1
在64位机器上,整数的位数为64位,取值范围-2**63~2*63-1
2.long(长整型,大一些的整数)
长度没有指定宽度,如果整数发生溢出,python会自动将整数数据转换为长整型
3.float浮点数
浮点数用来处理实数,即带有小数的数字。
52.3E-4是浮点数的例子。E标记表示10的幂。在这里,52.3E-4表示52.3 *10**4
二、布尔值
真或假 1或0
三、string字符串
"hello... | true |
9773612becba4ec5ca771b97cc69416af93799ef | Astrodude11/mplStyle | /mplStyle/types/convert/toFile.py | UTF-8 | 3,383 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | #===========================================================================
#
# Copyright (c) 2014, California Institute of Technology.
# U.S. Government Sponsorship under NASA Contract NAS7-03001 is
# acknowledged. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifica... | true |
0ff0544ebfd2f6e722a2b31307a98781dc8f18f0 | JeromeRGero/testing-django | /apps/quotes/models.py | UTF-8 | 4,401 | 2.515625 | 3 | [] | no_license | from __future__ import unicode_literals
from django.db import models
import bcrypt, datetime
# Create your models here.
class User_Manager(models.Manager):
def validate_reg(self, pack):
errors = []
checkName = pack['full_name']
checkAlias = pack['alias']
checkEmail = pack['email']
... | true |
c4f2a53147dea3f7281ac6192cdea60fd12e576a | ynanigashi/til | /atcoder_py/ABC220-C_20210926.py | UTF-8 | 180 | 2.75 | 3 | [] | no_license | n = int(input())
a = list(map(int, input().split()))
x = int(input())
sum_a = sum(a)
d, m = divmod(x, sum_a)
i = 0
while m >= 0:
m -= a[i]
i += 1
print(d*len(a)+i) | true |
65d06fd31724fd1f697a6099c38149836f77fb02 | kkkazumi/teensy_prog | /ir_sma/serial_read.py | UTF-8 | 1,207 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import serial
import socket
import sys
import threading
import binascii
# シリアル通信の設定(
ser = serial.Serial("/dev/ttyACM0", 921600, timeout=1)
def react_formula(ir_value):
sma_val=ir_value*2/3
return sma_val
if __name__ == '__main__':
while True:
serial_data = ser.read()
... | true |
401ed38bcebfa91f9ab79719b6a554c0d4952fde | junho-one/algorithm | /jongman/dp/PI.py | UTF-8 | 2,904 | 3.46875 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10**6)
def calculate_level(S) :
# level 1 test
if len(set(S)) == 1 :
return 1
# level 2 test
prev = S[0]-1
for val in S :
if val - prev != 1 :
break
prev = val
else :
return 2
prev = S[-1] - 1
for val in rev... | true |
c122cad49cbd1a349dda1c28c9fcb60c2ff2b60c | MartinCarufel/learn_panda | /duplicate.py | UTF-8 | 2,669 | 2.734375 | 3 | [] | no_license | #codinf:utf-8
import pandas as pd
import variable
import tkinter.filedialog
import matplotlib.pyplot as plt
import save_file
not_a_resto = ["AGOO", "BELL", "JEAN COUTU", "IGA", "LE LUNCH", "METRO", "NETFLIX", "RONA", "CDN TIRE", "ULTRAMAR" ,"VIRGIN"]
# not_a_resto = ["AGOO"]
# resto = ["AU COQ", "DOMINOS", "EGGSQUIS"... | true |
f6e24dda30b3ec014620272021560d5cd9612103 | clturner/webstack_basics | /0x01-python_basics/6-replace_in_list.py | UTF-8 | 306 | 3.75 | 4 | [] | no_license | #!/usr/bin/python3
"""
function that replaces an element of a list at a specific position.
"""
def replace_in_list(my_list, idx, element):
if idx > len(my_list) - 1 or idx < 0:
return(my_list)
else:
my_list.pop(idx)
my_list.insert(idx, element)
return(my_list)
| true |
c810566a1ff454b05ea9781ee174b40b3ec01708 | b72446916/270201062 | /lab5/example3.py | UTF-8 | 101 | 2.625 | 3 | [] | no_license | x = int(input("Write a positive integer"))
y = int(input("Write another positive integer"))
if x //1
| true |
65b99b1c1cc1b92db1670c0086b3886506e3b823 | xudon9/ichttpd | /www/cgi-bin/change_wish_data.py | UTF-8 | 771 | 2.625 | 3 | [] | no_license | #!/usr/bin/python3
import sqlite3
import datetime,time
import get_db_path
def add_wish(name, title, wish, contact_info, ctime=time.localtime(), thumb_up = 0):
format_time = time.strftime('%Y-%m-%d %H:%M:%S',ctime)
connection = sqlite3.connect(get_db_path.db_path())
cursor = connection.cursor()
cursor.execute("... | true |
bcd662713db3c80fcb2db60ff1dcd62e9d0657ea | andrejeller/HTML_PressKit_Generator | /project_scripts/python_v0.2/HTMLPressKitGenerator.py | UTF-8 | 2,255 | 2.609375 | 3 | [
"MIT"
] | permissive | import time
import keyboard
import LitteHelp
import ScreensAndFunctions
# python -m nuitka --onefile --windows-onefile-tempdir-spec=%TEMP%\\onefile_%PID%_%TIME% HTMLPressKitGenerator.py
LANGUAGE = 1
GO_BACK = False
ACTIVE_SCREEN = 0
LitteHelp.CheckRepo('./images')
def Voltar(event):
global GO_BACK
if ev... | true |
18602f7dcf3bb9d180a20d7d0c1ab44b47d3ea84 | Ghanouch/E-Wally | /src/mapping_module/db/creationBDD.py | UTF-8 | 866 | 2.609375 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect('WALL-E-Motion.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE Properties
(id INT PRIMARY KEY NOT NULL,leds_color VARCHAR(100),leds_frequence VARCHAR(100),leds_intensite VARCHAR(100),leds_texte VARCHAR(100),secondary_color VARCHAR(100),list_colo... | true |
fb9613567bb72e7d954011e738cee141a2666657 | qfizik/BEP | /Code/test_cnf_mcx.py | UTF-8 | 904 | 2.671875 | 3 | [] | no_license | import math
def mcx(qc, q, a, b, c):
mcx_r(qc, q, a, b, c)
def mcx_r(qc, q, a, b, c):
qc.barrier()
qc.h(q[c])
if a+1 == b:
qc.cx(q[a], q[c])
else:
mcx_r(qc,q,a,b-1,c)
qc.tdg(q[c])
qc.cx(q[b], q[c])
qc.t(q[c])
if a+1 == b:
qc.cx(q[a], q[c])
else:
mcx_r(qc,q,a,b-1,c)
qc.tdg(q[c])
qc.cx(q[b], q[c])
... | true |
cb2bf294ac2450db1c1f254921e5b1abdbfa2f17 | halilkrkn/Python-NumPy-Pandas | /Numpy/Numpy/Linspace.py | UTF-8 | 231 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
#a = np.linspace(1,10,10)
#print(a)
# from ... import ... ile numpy kütüphanesinden pi yi al demiş olduk.
from numpy import pi
x = np.linspace(0,2*pi,100)
print(x)
print(np.sin(x)) | true |
27c4264902d34388ed015e5e737bfaedc7c3e193 | VincentGaoHJ/Sword-For-Offer | /rsc/1_easy/offer_09.py | UTF-8 | 1,916 | 3.921875 | 4 | [] | no_license | # coding=utf-8
"""
@Time : 2020/7/23 19:27
@Author : Haojun Gao (github.com/VincentGaoHJ)
@Email : vincentgaohj@gmail.com haojun.gao@u.nus.edu
@Sketch : 剑指 Offer 09. 用两个栈实现队列
https://leetcode-cn.com/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/
"""
class CQueue(object):
def __init__(self):
... | true |
6cc92976e2d0b684184a96489b71e8ec830c4d48 | rotemmi4/FinalProject | /model/dao/TextDAO.py | UTF-8 | 672 | 2.828125 | 3 | [] | no_license |
def insert_text(name, content):
return ("INSERT INTO texts (name, content) values (?, ?)")
def update_text(id, name, content):
return ("UPDATE texts set name=?, content=? where id=?)", [name, content, id])
def delete_text(id):
return ("DELETE FROM texts WHERE [id] in (?)")
def get_text_by_id(id):
r... | true |
ad2b02da023b3e78d727e6fba5fdd03ee95a55f8 | qmnguyenw/python_py4e | /geeksforgeeks/algorithm/basic_algo/3_20.py | UTF-8 | 6,680 | 4.53125 | 5 | [] | no_license | Finding the Parity of a number Efficiently
Given an integer N. The task is to write a program to find the parity of the
given number.
**Note** : Parity of a number is used to define if the total number of set-
bits(1-bit in binary representation) in a number is even or odd. If the total
number of set-bits ... | true |
9f89cc43a4181cabf116bc88ee31c82ba75978fd | societynong/qtRadio | /deepnetwork.py | UTF-8 | 3,563 | 2.515625 | 3 | [] | no_license | import torch
from torch import nn
from torchvision import models
class FeatureNet(nn.Module):
def __init__(self):
super(FeatureNet,self).__init__()
# vgg = models.vgg19(pretrained=True).cuda()
# self.feature = vgg
# self.feature.add_module('global average',nn.AvgPool2d(9))
... | true |
055465f0bd21071f640cca7b303d48ba97cdc077 | ggljzr/mi-dip-impl | /garage_system/mod_auth/config_manager.py | UTF-8 | 2,495 | 3.15625 | 3 | [
"LGPL-3.0-only"
] | permissive | from passlib.hash import argon2
import configparser
DEFAULT_PASSWORD = 'password'
"""
Class for managing user_config.ini.
Allows checking and updating password and phone number.
"""
class ConfigManager():
def __init__(self, config_path):
self.config_path = config_path
self.reload_config()
d... | true |
e9b93a98d10c899e4811b4a9f398d46cc686b4c9 | LloydNicholson/fun-py-projects | /war_game.py | UTF-8 | 4,297 | 4 | 4 | [] | no_license | import random
# Two useful variables for creating Cards.
SUITE = 'H D S C'.split()
RANKS = '2 3 4 5 6 7 8 9 10 J Q K A'.split()
class Deck:
"""
This is the Deck Class. This object will create a deck of cards to initiate
play. You can then use this Deck list of cards to split in half and give to
the p... | true |
96c70afadea5a3105c700d934bedf83c1c99f085 | babaliauskas/Python | /CSV/dictReader.py | UTF-8 | 176 | 2.984375 | 3 | [] | no_license | from csv import DictReader
with open('CSV/fighters.csv') as file:
csv_reader = DictReader(file)
for row in csv_reader:
# print(row)
print(row['Name'])
| true |
c66f6b5f74e0ffdf7d3c897c2f80ca1fa6b92afb | ledbutter/ProjectEulerPython | /Problem26.py | UTF-8 | 1,739 | 3.421875 | 3 | [
"MIT"
] | permissive | # A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
# 1/2 = 0.5
# 1/3 = 0.(3)
# 1/4 = 0.25
# 1/5 = 0.2
# 1/6 = 0.1(6)
# 1/7 = 0.(142857)
# 1/8 = 0.125
# 1/9 = 0.(1)
# 1/10 = 0.1
# Where 0.1(6) means 0.166666..., and ha... | true |
f166536667dcc325eea54fb803af9d293edd3397 | Gohar-Ghukasyan/Billiard_Game | /Game/ball.py | UTF-8 | 5,331 | 2.859375 | 3 | [] | no_license | import itertools
import math
from enum import Enum
import numpy as np
import pygame
import config
import physics
class Ball:
def __init__(self):
self.pos = np.zeros(2, dtype=float)
self.velocity = np.zeros(2, dtype=float)
def apply_force(self, force, time=1):
# f = ma, v = u + at ->... | true |
5d7a2ce39a05832386b86815f15e74ce5edf263d | VeroMorera/python_basico_2_2019 | /semana03/ejercicio1_listas.py | UTF-8 | 566 | 3.703125 | 4 | [] | no_license |
mis_frutas = ['mango', 'kiwi', 'manzana', 'naranja', 'fresa', 'uva']
print(mis_frutas)
# consultar si elemento X esta en la lista, en este caso banano.
'banano' in mis_frutas
# consultar si elemento X NO esta en la lista, en este caso banano.
'banano' not in mis_frutas
#agregar una nueva fruta a la lista
mis_fruta... | true |
bcfd12cbbf663758bacc7858c08a5da7f7e2bec3 | Aasthaengg/IBMdataset | /Python_codes/p02963/s310121349.py | UTF-8 | 143 | 2.578125 | 3 | [] | no_license | def main():
s = int(input())
p, q = divmod(-s, 10 ** 9)
print(0, 0, 1, 10 ** 9, abs(p), q)
if __name__ == '__main__':
main()
| true |
cacdfcfe12bf36f2211d5d06f2e5181ac380801a | rtuggle/project-DirectCertification | /Python/vizmaker.py | UTF-8 | 6,706 | 2.8125 | 3 | [] | no_license | import pandas as pd
from matching_engine import matchmaker
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
def vizmaker(snap,school, school_name, fname_func, lname_func, dob_func, add_data, threshold, threshold_label, filename_prefix):
filename_prefix = filename_prefix+"_"+schoo... | true |
171b088e0ff28be6f81d0f3e085de2822adda136 | NokiYola/pydnn | /utils/createLeNet5.py | UTF-8 | 2,680 | 2.6875 | 3 | [] | no_license | from NeuralNetwork import NeuralNetwork
from layers.FullyConnectedLayer import FullyConnectedLayer
from layers.ConvolutionLayer import ConvolutionLayer
from layers.MaxPool import MaxPool
from utils.activationFunctions import sigmoid
def createLeNet5(indputDim, regParam=0.001, regString="L2"):
########## FIRST LAY... | true |
1be740fd2b20ad3af09c0957b45f0ebb915b1f1c | tocheng/Book-Exercises-Intro-to-Computing-using-Python | /OCW-Lecture-6-Dict-Song-Lyrics-Parser.py | UTF-8 | 3,312 | 4.3125 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 04 2021 - 10:22
Introduction to Computation and Programming Using Python. John V. Guttag, 2016, 2nd ed
A complimentary exercise from the book companion,
the OCW video lecture series - Lecture 6
Song Lyrics parser
https://ocw.mit.edu/courses/electrical-engineering-and-c... | true |
6b1c6ea6acc425c59a3862e96e82c5d1d6821f05 | Mohamed-Adhil/Terv-Solutions | /Trev Programmin-Prerequisities/Mars Astronuts 2.py | UTF-8 | 964 | 4.125 | 4 | [] | no_license | '''
Mars Astronauts 2
By definition, a sidereal day on Mars is the length of time that it takes the planet to rotate once on its axis so that stars appear in the same place in the night sky. On Earth, this takes exactly 23 hours, 56 minutes and 4.1 seconds. In comparison, on Mars, a sidereal day lasts 24 hours, 37 mi... | true |
513c5edb3897943b89caaa0d8b50a42e5170e0f7 | dubirajara/learning_python | /spot.py | UTF-8 | 452 | 2.75 | 3 | [] | no_license | import sys
import spotipy
spotify = spotipy.Spotify()
#results = sp.search(q='weezer', limit=20)
#for i, t in enumerate(results['tracks']['items']):
# print(i, t['name'])
if len(sys.argv) > 1:
name = ' '.join(sys.argv[1:])
else:
name = 'Radiohead'
results = spotify.search(q=f'artist:{name}', type='artist'... | true |
3a2b2c0c32b5996ce91cb8d9ebbcb9eb73acf3ad | gsakkas/seq2parse | /src/tests/parsing_test_55.py | UTF-8 | 392 | 3.3125 | 3 | [] | no_license | def palindrome():
for i in range(999,100,-1):
for j in range(999,100,-1):
product = i*j
productString = product
highestPalindrome = 22
if (productString[::-1] == product):
checkPalindrome(highestPalindrome, product)
def checkPalindrome(palindromeN, product):
p... | true |
5fbd5dcdf7bdc44c8f3087db623da74b0ff17abd | NCATS-Gamma/robokop | /manager/util.py | UTF-8 | 3,081 | 2.640625 | 3 | [
"MIT"
] | permissive | """
ROBOKOP utilities
"""
import os
import warnings
import logging
import json
import requests
from flask import session
from celery.task.control import inspect
from manager.user import get_user_by_id
from manager.logging_config import logger
def getAuthData():
""" Return relevant information from flask sessio... | true |