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 |
|---|---|---|---|---|---|---|---|---|---|---|
87b9cd6e2787dd4756d02b5e91d56feaaff74c25 | samyak1903/GUI-1 | /A1.py | UTF-8 | 308 | 3.8125 | 4 | [] | no_license | #Q1. Write a python program using tkinter interface to write Hello World and a exit button that closes the interface.
from tkinter import *
root=Tk()
hwL=Label(root,text='Hello World',font='Times 20 bold underline')
hwL.pack()
exitB=Button(root,text="Exit",command=root.destroy)
exitB.pack()
root.mainloop()
| true |
95b57a1b19f1ce7371be479103a12cde0f11cefe | kononovk/HomeTasks | /hw1/t05.py | UTF-8 | 158 | 4.25 | 4 | [] | no_license | s = input("Input string: ").lower().replace(' ', '')
if s == s[::-1]:
print("This string is palindrome")
else:
print("This string is not palindrome")
| true |
532ef0e7280a7d6328bbde0dc6c03b754109026b | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc091/A/3280692.py | UTF-8 | 52 | 2.515625 | 3 | [] | no_license | n,m=map(int,input().split());print(abs((n-2)*(m-2))) | true |
7aca7b3a98729c80360e333c0d9fcb6474ac8e3d | XIAHUALOU/logExtract | /threadsPool/t_pool.py | UTF-8 | 3,451 | 3.234375 | 3 | [] | no_license | import threading
import contextlib
from queue import Queue
class ThreadPool(object):
def __init__(self, max_num):
self.StopEvent = 0 # stop signal,if get task is StopEvent,Stop current task
self.q = Queue()
self.max_num = max_num # maxiumum threads
self.terminal = False #
... | true |
093621dae0f7caf4ce9b09071de14743ff17838b | sakalyah/SeleniumPOMPythonFramework | /Base/Selenium_Driver.py | UTF-8 | 17,212 | 2.75 | 3 | [] | no_license | import os
import time
from traceback import print_stack
from selenium import webdriver
from selenium.webdriver.common.by import By
from Drivers.BrowserLaunch import BrowserLaunch
from Drivers.BrowserLaunch import ElementsandData
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support ... | true |
7c73e1ea11cb05c13e2c9fd197d9a88408a866e4 | XorJoep/Joost_FaceRecHoedjes | /threadingprobeersels.py | UTF-8 | 2,704 | 2.53125 | 3 | [] | no_license | import cv2
import mss
import numpy as np
import time
import threading
from queue import Queue
numframes = 1000
_all = True
def MSS2CV2(im):
im = np.flip(np.array(im)[:, :, :3], 2) # 1
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB) # 2
return im
def localframe(region):
with mss.mss() as sct:
whi... | true |
9d8342e40952fc34f9500c84a8e3a77824154bd6 | AlexTMallen/trafficLight | /makeNewCarColorImages.py | UTF-8 | 2,224 | 2.65625 | 3 | [] | no_license | import numpy as np
from skimage import data, io
from matplotlib import pyplot as plt
dirs = ["Right", "Left", "Up", "Down"]
carIms = []
for dir in dirs:
carIms.append(io.imread("yellowCar" + dir + ".png"))
greenCars = [np.zeros((12, 25, 4)), np.zeros((12, 25, 4)), np.zeros((25, 12, 4)), np.zeros((25, 12, 4))]
blu... | true |
77f8690e78bba69df4ce119dfd8d1689439ffd2d | ivn-svn/python-advanced-1 | /05-functions/function_executer.py | UTF-8 | 368 | 3.40625 | 3 | [] | no_license | def func_executor(*args):
results = []
for func_set in args:
name, func_args = func_set
results.append(name(*func_args))
return results
def sum_numbers(num1, num2):
return num1 + num2
def multiply_numbers(num1, num2):
return num1 * num2
print(func_executor((su... | true |
ef0eecd505476a27eea6543752ef088fd60f69ac | andradenathan/num-inteiros-e-criptografia-2020-2 | /trabalhoFinal/trabalhoFinalRSA.py | UTF-8 | 4,156 | 3.46875 | 3 | [] | no_license | from millerRabin import miller_rabin
from euclides import euclides, euclides_estendido
from codigo import códigos_para_símbolos, símbolos_para_códigos
from random import randrange
# Questão 9a.
def gera_primos(n):
"""
Gera um número p primo de n algarismos
Entrada: O tamanho do número p a ser gerado
Sa... | true |
b9773dcdf403ed633288b7933685bce70a40aaa0 | micbentz/Udacity | /Python/mindstorms.py | UTF-8 | 537 | 3.8125 | 4 | [] | no_license | import turtle
def draw_square(a_turtle) :
for i in range(0,4):
a_turtle.forward(100)
a_turtle.left(123)
#a_turtle.right(90)
def draw_art():
window = turtle.Screen();
window.bgcolor("blue")
# create brad
brad = turtle.Turtle();
brad.speed(50)
for i in range(0,3... | true |
1f9ef6b026cfbbe87f9493a8cd4afd40b6d8f482 | alaskaw/kaggle_utils | /kaggle_utils/features/__init__.py | UTF-8 | 781 | 2.71875 | 3 | [] | no_license | from itertools import combinations
from sklearn.metrics import normalized_mutual_info_score
from .base import *
from .category_embedding import *
from .category_encoding import *
from .groupby import *
from .row_aggregations import *
def merge_columns(dataframe, columns):
new_column = '_'.join(columns)
datafr... | true |
1dbeaa1449bf893b37d4d7b7132b1bde5281b092 | thijskruithof/sqrmelon | /SqrMelon/modelsoutliner.py | UTF-8 | 11,424 | 2.53125 | 3 | [
"MIT"
] | permissive | import cgmath
from qtutil import *
from models import *
import icons
class ModelsModel(QAbstractItemModel):
"""
ItemModel wrapped around a Models object,
to expose it to our models outliner.
"""
def __init__(self, models):
super(ModelsModel, self).__init__()
self._models = models
... | true |
5371ae6edc7e913b8fb374a698ca24146e9ee040 | marktennyson/chalice-jwt | /chalice_jwt/authenticator.py | UTF-8 | 536 | 2.984375 | 3 | [
"MIT"
] | permissive | from jwt import encode, decode
class Authenticator:
def __init__(self,jwtAlgorithm, jwtSecret):
self.jwtAlgorithm = jwtAlgorithm
self.jwtSecret = jwtSecret
def createToken(self, payload):
if len(payload) > 2: return False
self.jwtToken = encode(payload, self.jwtSecret, self.jwtA... | true |
810a4dce8d95a6fc1ac66cfa825b151443e19b2f | tony9402/baekjoon | /solution/string/1181/main.py | UTF-8 | 329 | 2.765625 | 3 | [
"MIT"
] | permissive | # Authored by : gusdn3477
# Co-authored by : -
# Link : http://boj.kr/c540e6d57a39460eb360903623b90eec
import sys
def input():
return sys.stdin.readline().rstrip()
N = int(input())
arr = []
for i in range(N):
arr.append(input())
arr = list(set(arr))
arr.sort(key = lambda x : (len(x), x))
for i in arr:
... | true |
e4947f3ed192dbaeac46b2df8833720421d0b69f | RodneyDong/python | /src/class/range1.py | UTF-8 | 919 | 3.890625 | 4 | [] | no_license | '''
1. start from 1, include stop
2. pass start, stop, step
'''
class range1:
def __init__(self, *args):
self.start = 1
self.step = 1
if len(args) < 1 or len(args) > 3:
raise ValueError("argument number has to be 1,2 or 3")
if len(args) == 1:
self.stop = args[... | true |
dc1c678590e42da2e35cc351f05db023d1b1507e | ufuk-trkz/cs-module-project-algorithms | /eating_cookies/eating_cookies.py | UTF-8 | 1,180 | 3.96875 | 4 | [] | no_license | '''
Input: an integer
Returns: an integer
'''
def eating_cookies_naive(n):
if n < 0:
return 0
elif n == 0:
return 1
else:
return eating_cookies_naive(n-1) + eating_cookies_naive(n-2) + eating_cookies_naive(n-3)
def eating_cookies(n, cache=None):
print(n)
# base cases
if ... | true |
baaca918408d481cff51cddb3275fe4afa8ed089 | twijohn/Twi-John-Codes | /bti.py | UTF-8 | 1,393 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
import urllib,sys
banner = """
____ _______ _____
| _ \ |__ __| |_ _|
| |_) | | | | |
| _ < | | | |
| |_) | _ | | _ _| |_
|____/ (_) |_| (_) |_____|
------------------------------------
Blind Twi Injection ... | true |
3d5235582187c5bb4a51b25031de9fc9dbae1d8b | Pranavan135/ProjectEulerSolutions | /052.py | UTF-8 | 620 | 3 | 3 | [] | no_license | def same_digits(A, B):
LA = list(str(A))
LB = list(str(B))
LA.sort()
LB.sort()
if LA == LB:
return True
else:
return False
N, K = map(int, input().split())
for num in range(125874, N + 1):
label = False
for iteration in range(2, K + 1):
if same_digits(num, itera... | true |
1435fefc8d6681464e6facf54c3b34216d14b9ad | nobuchiba1006/DOUMEKI | /scripts/AnlAcceptance_megg.py | UTF-8 | 5,421 | 2.5625 | 3 | [] | no_license | """
Data class for simulation used by dominant
"""
import numpy as np
import math as m
import os
import sys
class Datum() :
def __init__(self, livetime=0, atmfluxes=None, promptfluxes=None, astrofluxes=None) :
self.thetas = []
self.phis = []
self.ces = []
self.insideids = []
... | true |
b4228073277399d0060c8c89309a2819c4e4db2c | ashsawh/stocks | /clusters/server/src/recon.py | UTF-8 | 1,471 | 3.4375 | 3 | [
"Apache-2.0"
] | permissive | from .day import Day
from typing import Dict
class Recon:
"""
Recon primarily returns differences in day 1 end to day 2 start that were somehow missed by transaction log
"""
@staticmethod
def compare(first_day: Day, second_day: Day) -> Dict:
"""
Compare two days to get differences
... | true |
7d1000442c274688d757cb01e96057d5935c4292 | Gandhar16/sliding-block-puzzles | /report/protocol.py | UTF-8 | 6,798 | 3.203125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Module used for the creation of an experiment protocol
We generate random puzzles, with different complexity and size
Then, we submit these puzzles to different algorithms in order to compare them
For a statistical view of the report, see the statistic.py module
"""
from __future__ import ... | true |
4c30803af2d253b5fa09f1b20f077652bc8f9396 | kalfsvag/persistent-homology | /persistencecycle.py | UTF-8 | 1,704 | 3.390625 | 3 | [] | no_license | """
Module containing the class PersistenceCycle
Author: Kristian Alfsvag
"""
class PersistenceCycle:
"""Class representing a cycle in persistent homology.
representative: cell generating cycle
killingSimplex: cell killing cycle
birth: birth of cycle
death: death of cycle
"""
def __eq__(self, other):
... | true |
e8cd585347a6f9b1122652491444406e4abfd93e | Santino-lab/programme | /ja nein generator.py | UTF-8 | 192 | 2.90625 | 3 | [] | no_license | import random
import colored
from colored import stylize
Optionen = ["ja", "nein","jain"]
Computerwahl = random.choice (Optionen)
print (stylize (Computerwahl,colored.fg("chartreuse_2a")))
| true |
a84f36bc8d433a6c8c104d08d7cb506ac66a173e | pohmelie/spoj | /GIRLSNBS.py | UTF-8 | 155 | 2.96875 | 3 | [] | no_license | from math import ceil
while True:
g, b = tuple(map(int, input().split()))
if g == -1:
break
print(ceil(max(g, b) / (min(g, b) + 1)))
| true |
66409a9de1cc404cf655842fd432ce874711e584 | odessit-qwerty/python-project-lvl1 | /brain_games/games/brain_progression.py | UTF-8 | 1,217 | 3.25 | 3 | [] | no_license | from brain_games import cli, engine
from brain_games.engine import ATTEMPTS
from random import randint
def make_progression():
progression_length = 10
step = randint(1, 10)
progression_first_number = randint(1, 10)
hidden_element_index = randint(0, progression_length - 1)
question = ''
counter... | true |
4ecb24bde642ad506972bbe42b1d0d1c483a751f | Re3write/leetcode | /105. Construct Binary Tree from Preorder and Inorder Traversal.py | UTF-8 | 406 | 3.1875 | 3 | [] | no_license | class Solution:
def buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode:
if inorder:
nodeval = preorder.pop(0)
index = inorder.index(nodeval)
node = TreeNode(nodeval)
node.left=self.buildTree(preorder,inorder[:index])
node.right = ... | true |
41774555aff8cca594fdabf2253f0e26b9630276 | HumphreyLu6/Scrapy-DoubanTop250 | /douban250/spiders/test.py | UTF-8 | 825 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#import imp
#scrapy = imp.load_source('scrapy', 'C:\Python27amd64\Scripts\scrapy.exe')
#from C:\Python27amd64\Scripts import scrapy
import sys
sys.path.append('C:\Python27amd64\Scripts\scrapy')
import scrapy
class TestSpider(scrapy.Spider):
name = 'test'
#allowed_domains = ['movie.douba... | true |
fe4fc5c96fd7a906a78d65726b48e4b54b9ca5c3 | igormrocha/Machine-Learning | /House-Price-Prediction/Project.py | UTF-8 | 4,258 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[2]:
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
# # Project
# In[3]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# In[4]:
df = pd.read_csv('bengaluru_house_prices.csv')
df
#... | true |
444d6c31caad11685e094ad0cbd5551764892828 | innocorps/pyIoT | /web/app/main/errors.py | UTF-8 | 2,213 | 2.65625 | 3 | [
"MIT"
] | permissive | """Calls webpage error templates, checks if JSON is needed first"""
from flask import render_template, request, jsonify, current_app
from . import main
from .. import logger
# pylint: disable=invalid-name
@main.app_errorhandler(404)
def page_not_found(e):
"""
Creates 404 Page not found error for an error, e, ... | true |
26ab28d3922154d97ff005911440a7f1d345a8a4 | osteele/slack-channel-manager | /channel_manager/commands.py | UTF-8 | 5,784 | 2.5625 | 3 | [
"MIT"
] | permissive | import csv
import time
import click
import pandas as pd
from jinja2 import Template
from slack_sdk.errors import SlackApiError
from .utils import die, load_csv
from .client import client, list_channels
def create_or_update_channel(channels, channel_name, topic=None, purpose=None, dry_run=False, is_private=False, jo... | true |
f82b095744b10e3001d7aed9b20a2c6956d394f7 | Aasthaengg/IBMdataset | /Python_codes/p03806/s398979177.py | UTF-8 | 1,484 | 2.796875 | 3 | [] | no_license | import sys
from itertools import product
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, Ma, Mb = map(int, input().split())
ABC = [list(map(int, input().split())) for _ in range(n)]
s = (n + 1) // 2
... | true |
93bade65882f51485e1a24fdf55e66fccd414b7c | Jihackstory/Baekjoon_solve | /Finish/BJ_9012.py | UTF-8 | 400 | 3.625 | 4 | [] | no_license | # 백준 9012 괄호
# 자료구조, 문자열, 스택
# 실버 4
import sys
N = int(sys.stdin.readline())
for _ in range(N):
check = 0
data = sys.stdin.readline().strip()
for idx in data:
if idx == '(':
check += 1
else:
check -= 1
if check < 0:
break
if check == 0:
... | true |
cd390957535076b610173d2d59d89ac002d3f592 | NhuThuong8103/H-Tree | /draw_tree.py | UTF-8 | 1,200 | 3.65625 | 4 | [] | no_license | import turtle
def h_tree(order, center, size):
draw_turtle(center, size)
if order > 0:
ep1, ep2, ep3, ep4 = get_endpoints(center, size)
h_tree(order - 1, (ep1, ep2), size / 2)
h_tree(order - 1, (ep1, ep4), size / 2)
h_tree(order - 1, (ep3, ep2), size / 2)
h_tree(order ... | true |
0cc4befff6ec77ae2234ea579de4fefcd480ff62 | adityachivu/pyseal-project | /server.py | UTF-8 | 2,518 | 2.828125 | 3 | [] | no_license | import socket
import os
from _thread import *
import hashlib
serversock = socket.socket()
host = socket.gethostname();
port = 9005;
serversock.bind((host,port));
filename = ""
serversock.listen(100);
print("Waiting for a connection.....")
def recv_CipherMatrix(socket, path):
"""
:param path:
:return:
... | true |
e0d7a249022f0946472520ec58a479f3ebbce0a7 | guidotournois-icemobile/recommender-workshop | /resources/tools.py | UTF-8 | 1,364 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 27 20:26:47 2018
@author: thomas IceMobile
"""
import pandas as pd
import numpy as np
import os
import warnings
class Normalizer():
"""Map any data to the (consecutive) iinterval [0 to N) (integers)
Input type can be any (string, int, fl... | true |
5201bb013d0efb38bcccb1f3cef9d75644fc0ee8 | LeilaPrelat/DNL-1-2020 | /entrega3_DNL/entrega3_DNL.py | UTF-8 | 1,576 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 22 16:03:50 2020
@author: leila
3 entrega DNL: Formas normales
http://materias.df.uba.ar/dnla2020c1/files/2020/06/DNL_formasnormales.pdf
"""
#%%
import numpy as np
import os
import sys
from sympy import symbols, lambdify
from sympy import solve... | true |
4880b8ecead2a0bfd6821d5068e6b0bbc9e5e1d2 | vznncv/bouy-spectrum-resotring-demo | /test/test_processing.py | UTF-8 | 7,997 | 2.515625 | 3 | [
"MIT"
] | permissive | import numpy as np
import scipy.signal as signal
from hamcrest import assert_that, greater_than, less_than
from unittest import TestCase
from spectrum_processing_1d.processing import calculate_acceleration, calculate_trajectory, \
calculate_particle_trajectory, estimate_spectrum
from spectrum_processing_1d.spectru... | true |
cf62fabb78ff7edc3228275b34266a7b349316ad | skeate/aoc | /solutions/python/2021/07.py | UTF-8 | 398 | 3.21875 | 3 | [
"MIT"
] | permissive | from typing import List
from statistics import median, mean
from functools import cache
@cache
def fuel(x):
r = 0
for i in range(x):
r += i+1
return r
def run(inp: List[str]):
pos = [int(x) for x in inp[0].split(',')]
target = int(median(pos))
print(sum(abs(x - target) for x in pos))
... | true |
365d01ea010a51d249013c334833a5675a21f7b5 | liyulun/mantid | /Framework/PythonInterface/test/python/mantid/geometry/RectangularDetectorTest.py | UTF-8 | 1,566 | 2.609375 | 3 | [] | no_license | import unittest
from mantid.geometry import *
from testhelpers import can_be_instantiated, WorkspaceCreationHelper
class RectangularDetectorTest(unittest.TestCase):
def test_RectangularDetector_cannot_be_instantiated(self):
self.assertFalse(can_be_instantiated(RectangularDetector))
def test_Rectangul... | true |
9ef39c9f2783ddf1fefa62e8c74f63546a0ed8be | jedzej/tietopythontraining-basic | /students/urtnowski_daniel/lesson_10_organizing_files/filling_in_the_gaps.py | UTF-8 | 2,517 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python3
"""
filling_in_the_gaps.py: a practice project "Filling in the Gaps" from:
https://automatetheboringstuff.com/chapter9/
The program finds in a single folder all files named with a given prefix
followed by a number and corrects any gaps in the numbering
Usage: ./filling_in_the_gaps.py <prefix> ... | true |
a75b7743a2499ec0015da9dafae263a674bc9b00 | jamiely/adventofcode | /2021/day16b.py | UTF-8 | 8,268 | 2.703125 | 3 | [] | no_license | import sys
import logging
from rich.logging import RichHandler
FORMAT = "%(message)s"
logging.basicConfig(
level="DEBUG", format=FORMAT, datefmt="[%X]", handlers=[RichHandler()]
)
log = logging.getLogger("rich")
line = open('day16.input').readline().strip()
hex_to_bit={
"0": "0000",
"1": "0001",
"2":... | true |
bc2c3c0cf378f5ddea279e86cd329d57f6547ab8 | moddamatt/Sprint-Challenge--Data-Structures-Python | /names/names.py | UTF-8 | 1,038 | 3.828125 | 4 | [] | no_license | import time
start_time = time.time()
f = open('names_1.txt', 'r')
names_1 = f.read().split("\n") # List containing 10000 names
f.close()
f = open('names_2.txt', 'r')
names_2 = f.read().split("\n") # List containing 10000 names
f.close()
# Since both files are read into a list i'm going to use a set type.
# Pytho... | true |
8990851ea760b3f9e55304768452884d2ca06c36 | galaxyluo/Leetcode | /python/slowestKey.py | UTF-8 | 508 | 2.90625 | 3 | [] | no_license | class Solution:
def slowestKey(self, releaseTimes: List[int], keysPressed: str) -> str:
if len(keysPressed) == 0:
return
tmpChar = keysPressed[0]
tmpMax = releaseTimes[0]
for i in range(1, len(releaseTimes)):
if releaseTimes[i] - releaseTimes[i - 1] > tmpMax:
tmpMax = releaseT... | true |
f164a2d1c567db82cc4cdb461df6adf6d7f6b555 | Wendy-Hsueh/python-exercise | /Lab 40_計算商品發生次數.py | UTF-8 | 468 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[33]:
def CountF1(S):
print(a)
oldlist = []
newlist = []
S={}
f = open(r'C:\Users\User\Downloads\DB.txt')
f2 = open('ItemIDList.txt','w')
f3 = open('DB_ItemID.txt','w')
for line in f:
print()
for j in line.split(","):
oldlist.append(j)
for i in oldlis... | true |
7fccc35e9c4efa1634c5835c4fd1623ec4470e70 | DikranHachikyan/python-programming-20190318 | /ex31.py | UTF-8 | 366 | 3.171875 | 3 | [] | no_license | #!/home/wizard/anaconda3/bin/python
def show(title, *args, kw1='A', kw2='B' ,**kwargs):
print(f'Title:{title}')
print(f'kw1:{kw1} , kw2:{kw2}')
def show2(title, *, kw1='A', kw2='B'):
print(f'Title:{title}')
print(f'kw1:{kw1} , kw2:{kw2}')
if __name__ == '__main__':
show('Text Editor',kw1='... | true |
0cc53955caa36bf8952fb02b649f9aec0092c512 | hichamkettani6/computer-sciences | /Python/src/2020-21/20201104_simple-functions.py | UTF-8 | 669 | 3.671875 | 4 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # ###### /=================================================\
# ####### | CLASS EXAMPLE FOR "COMPUTER SCIENCES" (07JCJ**) |
# #### \ | https://github.com/squillero/computer-sciences |
# ###G c\ | |
# ## _\ | © 2020 Giovanni Squi... | true |
7c73b3561136de2a8726482869172bf643852162 | AchilleBineli/INF8215_TP | /TP1/graph.py | UTF-8 | 3,966 | 3.359375 | 3 | [] | no_license | import numpy as np
import copy
import time
from queue import Queue
def read_graph():
return np.loadtxt("montreal", dtype='i', delimiter=',')
class Solution:
def __init__(self, places, graph):
"""
places: a list containing the indices of attractions to visit
p1 = places[0]
pm = ... | true |
60d1c4c097c76998605d84c256a3d90d88c31b3a | climatepals/Public-Opinion-on-Climate-Change-Initiatives | /TwitterDataAnalysis/twarc_data_extraction.py | UTF-8 | 1,872 | 2.6875 | 3 | [] | no_license | import twarc
import json
from pandas.io.json import json_normalize
def get_twitter_api_credentials():
with open('../Data/twitter_credentials.txt') as json_file:
data = json.load(json_file)
consumer_key = data['consumer_key']
consumer_secret = data['consumer_secret']
access_token = data['access... | true |
38ca5ce7647d1306111b5ac2cc342eef07bde238 | vishgit19/Sentiment_Analysis_using_LSTM | /test.py | UTF-8 | 702 | 2.59375 | 3 | [] | no_license | from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.preprocessing.text import one_hot
import nltk
import re
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from nltk.tokenize import word_tokenize
text=input()
ps = PorterStemmer()
review=text.lower()
nltk.... | true |
e6818c4532c8a2d5acfb1afe482b0410250480eb | anjulkumar2019/Python-Basics | /Append and Concatenate in Pandas.py | UTF-8 | 4,579 | 4.03125 | 4 | [] | no_license | """
Combining datasets: Concat and Append
Pandas includes functions and methods that make this sort of data wrangling fast and straightforward
"""
import pandas as pd
df1 = pd.DataFrame(['a','b','c','d'],columns=['df1'], index=[1,2,3,4])
df2=pd.DataFrame(['e','f','g','h'], columns=['df2'], index=[1,2,3,4])
"""
Panda... | true |
677fe2fcb640031dc5867507541c2221a20f3351 | qleez/Python | /gc_content.py | UTF-8 | 385 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Given: At most 10 DNA strings in FASTA format (of length at most 1 kbp each).
# Return: The ID of the string having the highest GC-content, followed by the GC-content of that string. Rosalind allows for a default error of 0.001 in all decimal answers unless otherwise stated; please see the no... | true |
c170b1b6489f09dbcb3c82178f98825c87937dc2 | tawachan/deep-lerning-study | /book1/chapter3/function.py | UTF-8 | 1,128 | 3.1875 | 3 | [] | no_license | import numpy as np
# import matplotlib.pyplot as plt
def step_function(x):
return np.array(x > 0, dtype=np.int)
def sigmoid(x):
return 1.0 / (1.0 + np.exp(-x))
def relu(x):
return np.maximum(0, x)
def identity_function(x):
return x
def softmax(x):
c = np.max(x)
exp_a = np.exp(x - c)
... | true |
0e5be3c74a10316d0a8ae282b8d52b835aff319d | Komei22/play_atcoder | /other/search_method/binary_search.py | UTF-8 | 819 | 3.828125 | 4 | [] | no_license | # bsのlistは降順にソートされていることが前提。targetは検索する値。
def bs(list, target):
left = 0
right = len(list)-1
# leftとrightが同値のときは、探索を終えたことを意味する。
while left <= right:
middle = (left+right)//2
val = list[middle]
if val == target:
return middle
# 検索する値targetが現在の中央の値valより小さい時、右側には... | true |
96029957aad3108e02fcd89001e28c8b266e1da0 | jonkelleyatrackspace/bakthat-cloudfiles | /filewalker.py | UTF-8 | 6,331 | 3.046875 | 3 | [] | no_license | """ Backups up encrypted (or not) and supports recursion into any directory as long as the file meets
the minumum backup age.
Also supports deleting file from local disk afterwards.
Before deleting the local copy it verifies the remote md5sum.
-- jon kelley Feb, 5, 2012
"""
"""
This requires a confi... | true |
042a63c6278e496a32631cf8242a87251d096675 | Muralidharan17/Python | /demo3.py | UTF-8 | 257 | 3.78125 | 4 | [] | no_license | #Printing variables with strings
likes = input("what do you like")
hates = input("what do you hate")
print("Murali likes : " , likes)
print("Murali hates : ", hates)
'''
output : Murali likes : what do you like (expects user ip)
'''
| true |
8c5d91abd45d8b2d00bd5f7063cea8c72596c2aa | loganBehnke/advent-of-coding | /2020/day4.py | UTF-8 | 1,944 | 2.953125 | 3 | [] | no_license | import re
def hasKeys(fields):
if fields.get('byr') == None:
return False
if fields.get('iyr') == None:
return False
if fields.get('eyr') == None:
return False
if fields.get('hgt') == None:
return False
if fields.get('hcl') == None:
return False
if field... | true |
fe9de3fb5162004709c384dd2c95f33574f37da6 | DuinoDu/codelib | /utils/timer.py | UTF-8 | 2,794 | 3.34375 | 3 | [
"MIT"
] | permissive | from __future__ import division
import time
import matplotlib.pyplot as plt
class Timer(object):
"""Timer tool recording running time
Examples:
>>> from utils import Timer
>>> timer = Timer()
>>> timer.start()
>>> for i in range(10):
>>> # do something
... | true |
54ba3878d633cb1667440f5fd5323e2955f348b0 | KornbergFresnel/garage | /examples/np/cem_cartpole.py | UTF-8 | 1,404 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
This is an example to train a task with Cross Entropy Method.
Here it runs CartPole-v1 environment with 100 epoches.
Results:
AverageReturn: 100
RiseTime: epoch 8
"""
from garage.experiment import LocalRunner, run_experiment
from garage.np.algos import CEM
from garage.np.baselines i... | true |
9ce202e12641ce569114fc89e0a79132f1934f21 | bukatyj/automation_task | /test/test.py | UTF-8 | 3,822 | 2.78125 | 3 | [] | no_license | from utils.helpers import Helper
from time import sleep
from selenium.common.exceptions import TimeoutException
from test import LOG
import pytest
class Test:
@pytest.mark.start_main_page
def test_main_page(self, browser):
prestashop_page = Helper(browser)
LOG.info("Open the main page of the s... | true |
751508347abe34e22766de7eae108e0a36427a00 | Vnicius/dados-pb | /dadospb/utils/format.py | UTF-8 | 594 | 3.953125 | 4 | [
"MIT"
] | permissive | def format_period(start_month, start_year, end_month, end_year):
'''
Formatar o perído de consulta em string
Params:
start_month (int): valor do mês inicial
start_year (int): valor do ano inicial
end_month (int): valor do mês final
end_year (int): val... | true |
e28640b3bdbd7179c2212d61a986a2198fe92abd | hltzba/PythonStudy | /ListDemo.py | UTF-8 | 2,136 | 3.953125 | 4 | [
"Apache-2.0"
] | permissive | # encoding:utf-8
def ReadAnimalsToList():
cats=[]
while True:
print("来,请输入一个猫的名字,不想玩了就直接回车:")
name=input()
if name=='':
break
cats=cats+[name]
print("来看看猫咪们都有哪些名字:"+str(cats))
zoo=['cat','bat','rat','elephant']
print("现在有这些个动物:"+str(zoo))
print("切片取第2个到第3... | true |
a21e31d662b20c0bafc41dd409a0a64c3f411d56 | elizabethchin/Lab_guessing_game | /game.py | UTF-8 | 112 | 2.96875 | 3 | [] | no_license | """A number-guessing game."""
# Put your code here
import random
name = input("Howdy, what's your name? >")
| true |
27ef77e73199457cfa356d4d20751117ac0fe9e9 | oshimamasara/ML_ASAGAO | /train.py | UTF-8 | 665 | 2.8125 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
import pickle
import requests
import json
dataset = pd.read_csv('data.csv')
x = dataset.iloc[:, :-1].values
print(x)
y = dataset.iloc[:, 1].values
print(y)
x_train, x_test, y_t... | true |
9e258ed30e776750a5fa0ae52325813b1701a0e1 | delroy2826/Programs_MasterBranch | /pynativedatastruct10.py | UTF-8 | 580 | 3.765625 | 4 | [] | no_license | #Question 9: Given a dictionary get all values from the dictionary
#and add it in a list but don’t add duplicates
#speed ={'jan':47, 'feb':52, 'march':47, 'April':44, 'May':52, 'June':53, 'july':54, 'Aug':44, 'Sept':54}
speed ={'jan':47, 'feb':52, 'march':47, 'April':44, 'May':52, 'June':53, 'july':54, 'Aug':44, 'Sept'... | true |
c53b12bc9e5b48fcf99e5ad3a96069fb6a67e100 | sound-ai-lab/Learn-physics-in-games | /02.acceleration.py | UTF-8 | 1,828 | 2.65625 | 3 | [] | no_license | import matplotlib.pyplot as plt
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
from IPython.display import HTML
from matplotlib.animation import FuncAnimation
v0 = 5 # [m/s]
a = 3 # [m/s2]
goal = 50 # [m]
frames = 600
fig, ax = plt.subplots(figsize=(16, 9))
image_path = []
image = []
im = []
for i ... | true |
c94d85fba9141d5f4e5c647c6fefc30acedeae7b | pansapiens/quantiprot | /examples/ex_uversky.py | UTF-8 | 1,540 | 2.78125 | 3 | [
"MIT"
] | permissive | import os
import sys
sys.path.insert(0, os.path.abspath('..'))
# Uversky plot
from quantiprot.utils.io import load_fasta_file
from quantiprot.utils.feature import Feature, FeatureSet
from quantiprot.utils.sequence import compact
from quantiprot.metrics.aaindex import get_aa2charge, get_aa2hydropathy
from quantiprot.me... | true |
3f157726361230aacdc0a44d2be11e25be3a8676 | fazilsmm/codekata | /Browse folder.py | UTF-8 | 625 | 2.875 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module5
# Purpose:
#
# Author: Fazil Smm
#
# Created: 22-06-2017
# Copyright: (c) Fazil Smm 2017
# Licence: <your licence>
#----------------------------------------------------------------------------... | true |
a6efecc8a46226a64f610200ed7616fa462b022d | karlosss/ep-apportionment | /sorting.py | UTF-8 | 387 | 3.234375 | 3 | [] | no_license | from collections import OrderedDict
def alphabetically(x):
keys = list(x.keys())
keys.sort()
out = OrderedDict()
for k in keys:
out[k] = x[k]
return out
def by_value(x, key):
out = OrderedDict()
tmp = []
for k, v in x.items():
tmp.append([k, v])
tmp.sort(key=key)
... | true |
eeec58fb08b946f565d6b0c41c2cd6f82e49d964 | AbhishekKhaneja/PythonTutorial | /PytestPackage/test_fixtures2.py | UTF-8 | 987 | 3.25 | 3 | [] | no_license | #so in this if we want ot use fixtures in each and every test then ist way io pass the fixture name into each and every test as a argument
# 2nd way is to declare IT inside a class and decalre it as :
import pytest
@pytest.mark.usefixtures("setup") #this will use the fixture from conftest file to all the methods decla... | true |
a3a1b6a9a968b34f445449cdd4db07322e71818d | jjoyce0510/autonomous-shipping-vessel | /src/main/python/control/Object.py | UTF-8 | 801 | 3.3125 | 3 | [
"MIT"
] | permissive |
# Object class used to help the driver determine where to go.
class Object:
distanceInCm = None
radProp = 0.0
angleFromCenter = 0.0
# This probably not always reliable, unless we are going straight into something.
def getDistance(self):
return self.distanceInCm
def setDistance(self, d... | true |
f43601178101087fb404461cf69d6075d663940d | gwk/pithy | /pithy/histogram.py | UTF-8 | 1,589 | 3.125 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | # Dedicated to the public domain under CC0: https://creativecommons.org/publicdomain/zero/1.0/.
from collections import Counter
from typing import ItemsView, Iterable, Iterator, Mapping, TypeAlias
Num:TypeAlias = float|int
class Histogram(Mapping[Num,int]):
def __init__(self, iterable_or_mapping:Iterable[Num]|M... | true |
24839ba53e6a5d2175cd0c92bdb288326b67e8d2 | Rambaldelli/SVM-GOR-Secondary-Structure-Prediction-Comparison | /MySVM.py | UTF-8 | 2,653 | 2.65625 | 3 | [] | no_license | import sklearn.svm
import ProtModel
import numpy as np
import sys
class SVM(ProtModel.Model): #classe per modello SVM, estende classe astratta modello generico e utilizza la classe SVC di SkLearn
def __init__(self, C, G):
self.C=C
self.G=G
def train(self,datat): #train the model gi... | true |
47d5bc1e6d1f8d74da87f2fd534ad345fd4cc502 | spaghettisource/python_hangman_game | /hangman.py | UTF-8 | 2,898 | 4.125 | 4 | [] | no_license | import string
number_of_guesses = 8
lettersGuessed = ['e', 'i', 'k', 'p', 'r', 's']
def getAvailableLetters(lettersGuessed):
'''
lettersGuessed: list, what letters have been guessed so far
returns: string, comprised of letters that represents what letters have not
yet been guessed.
'''
avail... | true |
3109bb23f41a668c1d7c127543211f5fe7c397a5 | NeoWhiteHatA/all_my_python | /januare/game_on_python_one.py | UTF-8 | 946 | 3.953125 | 4 | [] | no_license | #this game for shose unit
import random
#import module random
guesseTaken = 0
#begin mean
#welcome
print('Hello! What is your name?')
myName = input()
number = random.randint(1, 26)
print('Ok, ' + myName + ', i am numbers secret from 1 to 25.')
#exit trying player
for guesseTaken in range(10):
print('Try numbe... | true |
7ea4296215ae41e9e02981fd9885b0b971297f83 | Eternally1/web | /python/fullstacks/week3/day6/context manager_1.py | UTF-8 | 736 | 3.109375 | 3 | [] | no_license | # @author: "QiuJunan"
# @date: 2018/3/17 10:11
# 上下文管理器,引言
# 2、使用装饰器
class Database(object):
def __init__(self):
self.connected = False
def connect(self):
self.connected = True
def close(self):
self.connected = False
def query(self):
if self.connected:
return ... | true |
21421a62659e44c410d2c46083120d2473cbff6e | sandeepgit32/Data_Structure_Tutorial_Python_Latex | /src/sort/selectionsort2.py | UTF-8 | 662 | 4 | 4 | [] | no_license | def selection_sort(input_list):
L = len(input_list)
Round_num = L-1
Iterations_per_round = [L-x for x in range(1, L)]
for rnd in range(Round_num):
for iteration in range(Iterations_per_round[rnd]):
for i in range(iteration, L-1):
if input_list[iteration] > ... | true |
9bc684ae1bb090f0309cc4e18a7d83111dd412cf | radinhamidi/Retrieving-Skill-Based-Teams-from-Collaboration-Networks | /cmn/utils.py | UTF-8 | 4,539 | 2.546875 | 3 | [] | no_license | import json
import numpy as np
import pandas as pd
import pickle
import scipy
import matplotlib.pyplot as plt
from copy import deepcopy
from sklearn import preprocessing
import itertools
import keras
import glob
from ml.team2vec import *
def crossValidate(data: np.ndarray, split1, split2):
data = np.asarray(data... | true |
01e5ee04bb604661d8f0efa4fc7b8a9cb49ff3e3 | zhugeming0918/mycmdb | /autoClient-0.1.1/lib/log.py | UTF-8 | 1,692 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
import os
import logging
from lib.singleton import singleton
from config import settings
@singleton # 单例模式
class Logger(object):
def __init__(self):
self.run_log_path = settings.RUN_LOG_PATH
self.error_log_path = settings.ERROR_LOG_PATH
se... | true |
acb9b3d10c3eedeec8452a4cbe7903ca4667a92f | radrajith/gerbmerge | /fileFind.py | UTF-8 | 286 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | import glob
import os
from os.path import isfile, join
a = raw_input("SubString: ")
os.chdir("/Users/wing/Desktop")
for filename in glob.glob("*.txt"):
if isfile(filename):
f = open(filename, 'r')
for line in f:
if(line.find(a) > 0):
print filename
break;
| true |
401515cc965af5cbd5c8bc82141de63375bfe624 | marcelotoledo/folha_job_posting | /folha.py | UTF-8 | 1,416 | 3.796875 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Source: http://hotsites.folha.com.br/2015/03/31/selecao/
#
# Sabe-se que por trás de cada cometa há um OVNI. Esses OVNIs
# frequentemente buscam bons desenvolvedores aqui na Terra.
# Infelizmente só têm espaço para levar um grupo de devs por vez. Para
# a seleção, há um eng... | true |
a77b00bd52502037a45cc6ea67a73e8408ebd602 | pyrish/scrapers | /old_scraper_scripts/pandas_monster.py | UTF-8 | 2,371 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import csv
from bs4 import BeautifulSoup
import os
import urllib.request
import pandas as pd
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.we... | true |
c6716a84d44c915c53d7ec27c3458ab3c2cbd373 | OliverSekiro/python_log | /matplotlib/multPlot3.py | UTF-8 | 928 | 3.296875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
# set random start point
np.random.seed(19680801)
# mean=loc,std devation=scale,amount=1000
y = np.random.normal(loc=0.5,scale=0.4,size=1000)
# limit y to the range(0,1)
y = y[(y>0) & (y<1)]
y.sort()
# generate a one-by-len array
x = np.arange(len(y))
# generate a ... | true |
37a0a928fbcc45b91ca5252d7d9b019391f0d19f | kyhau/small-coding-exercises | /hackerrank/kangaroo.py | UTF-8 | 401 | 3.53125 | 4 | [] | no_license | """
https://www.hackerrank.com/challenges/kangaroo/problem
"""
# Complete the kangaroo function below.
def kangaroo(x1, v1, x2, v2):
# x1 + v1 * n = x2 + v2 * n
# => n = (x1 - x2) / (v2 - v1)
if v1 == v2:
return "YES" if x1 == x2 else "NO"
r1 = (x1 - x2) / (v2 - v1)
r2 = (x1 - x2) //... | true |
a2d45e76698ebe8d777d1852852024dd9211ddce | Twiggi/School_Python | /afj4/afj4.py | UTF-8 | 5,751 | 2.703125 | 3 | [] | no_license | #!python
import os
import sys
#filepath = "afj5.txt"
#filepathOUT = "afjOUT.txt"
filepath = sys.argv[1]
filepathOUT = sys.argv[2]
subor_out = {}
subor_out_other_way_around = {}
riadok_v_subor_out = 1
najvacsia_zatvorka = 99
def najvacsie_cislo_v_liste(l):
cisla = []
for i in range(0, len(l)):... | true |
41febd864f98fe4892e12d44931d1ea34ec92341 | amohanta/malware_classification | /python/analysis.py | UTF-8 | 5,369 | 2.9375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
from sklearn.preprocessing import label_binarize
from sklearn.metrics import confusion_matrix
import feature_generation
import utilities
import naive_bayes_classifier
import svm_classifier
import rf_classifier
from matplotli... | true |
f3c060dab11385981138ed568480227d3dce8f2c | AveryBodenstein/Lepton-Balloon | /ms5637/ms5637_test.py | UTF-8 | 2,763 | 2.53125 | 3 | [] | no_license | # Distributed with a free-will license.
# Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
# MS5637_02BA03
# This code is designed to work with the MS5637-02BA03_I2CS I2C Mini Module available from ControlEverything.com.
# https://www.controleverything.com/content/Analo... | true |
fdb9e1d7b139a25a0ae7c49a28a7141c5227dbd1 | killkamad/PC-home | /Algoritmi/02.04.19.py | UTF-8 | 803 | 3.34375 | 3 | [] | no_license | import turtle
a=turtle.Turtle()
a.speed(100)
a.pensize(2)
def myname():
a.up()
a.setpos(-100,200)
print (a.xcor())
print (a.ycor())
a.down()
for i in range(5):
# a.right(16.37)
# a.forward(10)
if i%2==0:
for i in range(10):
a.right(16.37)
a.forward(10)
a.setheading(180)
else :
for i in ... | true |
b17c086403c40a965e9015cbb26c72e0f54991da | WilliamOnVoyage/PersonalWeb | /src/util/aux_functions.py | UTF-8 | 1,408 | 3.25 | 3 | [] | no_license | import datetime
import math
import socket
import ipgetter
def check_ip():
external_ip = ipgetter.myip()
print("External ip:%s " % external_ip)
local_ip = socket.gethostbyname(socket.gethostname())
print("Local ip:%s " % local_ip)
def check_date():
d = datetime.datetime.now().date()
return d... | true |
e279b37812927d2e24879448fb410cdce60099a5 | DSSerialGeneva/cd15c0un7 | /src/spark/job_transform_bson_to_grayscale_matrix.py | UTF-8 | 2,990 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import sys
import pymongo_spark
from pyspark import SparkContext, SparkConf
from PIL import Image
from cStringIO import StringIO
# Print job arguments
print sys.argv
def jpeg_binary_to_grayscale_array( jpeg ):
str_jpeg = StringIO(jpeg)
image = Image.open(str_jpeg)
grayscale_image = image.convert('L')
grayscal... | true |
4db866051541eb25bea1c298826dce5c62a99e6f | bloer/bgmodelbuilder | /bgmodelbuilder/test/testsimdb.py | UTF-8 | 5,860 | 2.59375 | 3 | [
"BSD-2-Clause"
] | permissive | import unittest
from ..component import Component, Assembly
from ..emissionspec import RadioactiveContam, CombinedSpec
from ..bgmodel import BgModel
from ..common import units
from ..simulationsdb import SimulationsDB, SimDataMatch
class TestingSimulationsDB(SimulationsDB):
"""Toy simulations database used for t... | true |
f39e8d7fa7401f1f0c57cfe5f06527c1cbbcc0d1 | DanieleSiri/adventofcode2020 | /day 10/day10.py | UTF-8 | 1,947 | 3.765625 | 4 | [] | no_license | # https://adventofcode.com/2020/day/10
file = open("day10_data", "r")
jolts_list = [int(x) for x in file.read().splitlines()]
jolts_list.insert(0, 0) # first element is 0 as per problem request
# sorting the list makes the iteration through it easier
jolts_list.sort()
# this is because we have to count the last jolt w... | true |
7f32be4aaf6a40b813d7457be3cf6825a8950dec | PhyloSofS-Team/thoraxe | /thoraxe/utils/split.py | UTF-8 | 1,515 | 3.84375 | 4 | [
"MIT"
] | permissive | """
split: Util functions to split s-exons.
"""
import numpy as np
def split_exons(exons):
"""
Return a list of the s-exons in the string.
>>> split_exons('3_0/3_1')
['3_0', '3_1']
>>> split_exons('4_0')
['4_0']
"""
if '/' in exons:
return exons.split('/')
return [exons]... | true |
0140cfa2a121dcda5af17f1a5daa55d1eb49ef67 | ssp4all/stackoverflow-scrapper | /main/scrape.py | UTF-8 | 5,621 | 2.890625 | 3 | [
"MIT"
] | permissive | # This file will scrape Stack Overflow site for a given query
import os
import random
import re
import sys
import time
import webbrowser
import requests
import urwid
from bs4 import BeautifulSoup
from termcolor import colored
from funtions import clear_terminal
from user_agents import user_agents
from offline_stacko... | true |
061b2729eac6bf7ce9315ec89dfea1d602504982 | Rincy-Anna/pythonprograms | /flow_of_cotrols/looping/min_max_even.py | UTF-8 | 187 | 3.796875 | 4 | [] | no_license | #input min & max number and print only even numbers
min=int(input("enter initial range "))
max=int(input("enter final range "))
for i in range(min,max+1):
if i%2==0:
print(i) | true |
3aa82ed8b3aa09df823623f82e93f7cdb38ae041 | PawarKishori/Alignment1 | /csv_creation1/merge_dictionaries.py | UTF-8 | 612 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[3]:
import sys
def merge(file1, file2):
filenames = [file1, file2]
with open(output_dict, 'w') as outfile:
for fname in filenames:
with open(fname) as infile:
for line in infile:
outfile.write(line)
input_dic... | true |
4074bb5e1b0793051db1a36e9dee31a93b16e428 | Fabii006/HomeWorks | /Atividades/lista sequencial/q12.py | UTF-8 | 122 | 3.515625 | 4 | [] | no_license |
h = float(
input("Informe sua altura em [m]: ")
)
h=((72.7*h) - 58)
print("Seu peso ideal seria: {:.2f}kg".format(h)) | true |
d1b6033f76ef746507f3aeb1b3f331a4fbfc4188 | morzack/kokoros-mask-run | /engine/story.py | UTF-8 | 1,455 | 3.078125 | 3 | [] | no_license | from .state import State
import pygame
import json
class Story(State):
def __init__(self, story_config):
"""
initialize the level given a number to pull from
"""
super().__init__()
with open(story_config, 'r') as f:
self.config_data = json.load(f)
sel... | true |
f1192fdf6a42f914715bb02a7dc6c348e1e26e7f | ShayanNazemi/FX-Backtesting | /Portfolios/ConstantRiskPortfolio.py | UTF-8 | 892 | 3.0625 | 3 | [] | no_license | from Portfolio import Portfolio
from Events import SignalEvent, OrderEvent
from Symbol import Symbol
class ConstantRiskPortfolio(Portfolio):
def __init__(self, init_capital, risk):
super(ConstantRiskPortfolio, self).__init__(init_capital)
self.open_positions = []
self.risk = risk
... | true |
e68863150839515c66a44af7d4cfbb1657df3c41 | mohithkumar242/Best-Enlist-python-internship | /day10.py | UTF-8 | 659 | 3.765625 | 4 | [] | no_license | #1
import re
string=input("enter a string")
chari = re.compile(r'[^a-zA-Z0-9.]')
string = chari.search(string)
if(not bool(string)):
print("string format is corrrect")
else:
print("String format is not correct")
print()
print()
#2
text=input("enter a string")
pattern = '\w*ab\w*'
if re.search(pattern, text... | true |
0959a771a280b41519fb4b56d8c9bf292ac5ef4e | lucile-baumann/AOC2018 | /Day5/AlchemicalReduction.py | UTF-8 | 793 | 3.40625 | 3 | [
"MIT"
] | permissive | # Advent of Code 2018
# --- Day 5: Alchemical Reduction ---
data = open('day5.txt').read().strip()
data1 = data
i=0
while i<len(data)-1:
#ord return the unicode code of a char
if abs(ord(data[i])-ord(data[i+1]))==32:
# remove the part
if i==len(data)-1:
data =data[:i]
else:
data =data[:i]+data[i+2:]
... | true |