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
286a75d8d83a1394971efd152e638f58862d1252
Python
rafaelperazzo/programacao-web
/moodledata/vpl_data/309/usersdata/299/73585/submittedfiles/atm.py
UTF-8
161
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import division import math #COMECE SEU CODIGO AQUI #entrada valor=int(input('Digite o valor: ') a=20 b=10 c=5 d=2 e=1
true
4eac959e01cab4d612d24a1003ee76393acd3cfc
Python
rolandstaring/machikoro
/content/dice/show_multi_dice.py
UTF-8
2,301
2.765625
3
[]
no_license
import sys import random from PyQt5 import QtWidgets as qtw from PyQt5 import QtGui as qtg from PyQt5 import QtNetwork as qtn from PyQt5 import QtCore as qtc class Dice(qtw.QWidget): def __init__(self, nr_of_dices ): super().__init__() self.title = 'Roll the dice' self.left = 10 self.top = 10 self.width...
true
d05708c7060f7101dcedd9cab999bfa5feeed119
Python
lioneleoy/FlaskAPI
/Basics/basicClass.py
UTF-8
236
3.15625
3
[]
no_license
class test: def __init__(self): self.name ="lionel" self.age = 25 self.numbers= (1,2,3,4,5) def total(self): result = sum(self.numbers) return result test1 = test() print test1.total()
true
866268df2d7924f71edde6c7fa631e085cf0bc26
Python
facebookresearch/vizseq
/vizseq/scorers/_cider/__init__.py
UTF-8
6,749
2.6875
3
[ "MIT", "BSD-2-Clause-Views" ]
permissive
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Adapted from # https://github.com/tylin/coco-caption/blob/master/pycocoevalcap/cider/cider_scorer.py # (authored by Tsu...
true
f93f1ed2b88f7c102d44add6cff0c1a9697250e5
Python
Hrishi29/anwala.github.io
/Assignments/A3/read.py
UTF-8
1,122
2.71875
3
[]
no_license
import justext import re para = '' d = {} inv = [] count = 1 while (count < 1001): with open('raw_html/%s.html' % count, 'r', encoding='utf-8') as fp: #reading the files for raw html content wordstring = fp.read() #extracting linguistic sentences from the content by excluding the boilerplate content paragrap...
true
36e4215c4f645afadedb979e072c1714196de3c4
Python
byi649/Design-Automation-Optimisation-for-Multi-Material-3D-Printing
/MultiMaterialBeam/heuristicVoxels.py
UTF-8
2,338
2.6875
3
[]
no_license
import blackbox import numpy as np import matplotlib.pyplot as plt import algos from toolkit import * N = 6 #ElementOrder = 1 if __name__ == '__main__': NGEN = 10 verbose = True nVoxels = 40 nPop = 10 algorithm = "GA_voxel" if algorithm == "GA_voxel": (bin, fbest, best) = algos.GA_...
true
5d9e70e7feacd2c208ef1afc8d9431d1f3e0d0a0
Python
KenAdeniji/WordEngineering
/IIS/WordEngineering/Python/flask.pocoo.org/BibleBookFile.py
UTF-8
1,618
3.359375
3
[]
no_license
""" 2020-02-16 Created. john.zelle@wartburg.edu; Postal address: Department of Math/CS/Physics Wartburg College 100 Wartburg Blvd. Waverly, IA 50677 http://127.0.0.1:5000 http://127.0.0.1:5000/bibleBooks http://127.0.0.1:5000/bibleBook/John https://www.pythonforbeginners.com/dictionary/how-to-use-dictionaries-i...
true
546387a5f92bbfd273f7cfedfbb9a2064df2800f
Python
geekori/numpy
/src/chapter02/demo10.py
UTF-8
354
3.84375
4
[]
no_license
# NumPy数组:分割数组 from numpy import * # 水平分割、垂直分割、深度分割 # 水平分割 a = arange(9).reshape(3,3) print(a) b = hsplit(a,3) print(b[0]) print(b[2]) # 垂直分割 print("---------") c = vsplit(a,3) print(c) print(c[0]) print(c[2]) # 深度分割 a = arange(27).reshape(3,3,3) print(a) b = dsplit(a,3) print(b)
true
4265f15f595de0b0123642eae840c30225b25e5e
Python
SMEISEN/pyWATTS
/examples/example_keras.py
UTF-8
4,044
2.859375
3
[ "MIT" ]
permissive
# ----------------------------------------------------------- # This example presents the code used in the advanced example # guide in the pyWATTS documentation. # ----------------------------------------------------------- import pandas as pd from sklearn.preprocessing import StandardScaler from tensorflow.keras im...
true
26d7125708f548872f408eb52b99d186f4d5245c
Python
nelhage/taktician
/python/tak/ptn/ptn.py
UTF-8
3,184
2.609375
3
[ "MIT" ]
permissive
import re import attr import tak from . import tps @attr.s class PTN(object): tags = attr.ib() moves = attr.ib() @classmethod def parse(cls, text): head, tail = text.split("\n\n", 1) tags_ = re.findall(r'^\[(\w+) "([^"]+)"\]$', head, re.M) tags = dict(tags_) tail =...
true
01d34de19d09ddd4405a0ef79c1664d25c4a0847
Python
PacktPublishing/OpenCV-4-for-Secret-Agents
/Section3/deep-learning-opencv/imageClassification.py
UTF-8
1,049
2.890625
3
[ "MIT" ]
permissive
import numpy as np import cv2 import time # load the input image from disk image = cv2.imread("images/image_02.jpg") # load the class labels from disk rows = open("synset_words.txt").read().strip().split("\n") classes = [r[r.find(" ") + 1:].split(",")[0] for r in rows] blob = cv2.dnn.blobFromImage(image, 1, (224, 2...
true
3b63626bd15c9a6f82fcece252b245be5dc98d71
Python
tathyam/bots_for_some_indian_shopping_sites
/snapdeal1.py
UTF-8
1,058
2.59375
3
[]
no_license
#! /usr/bin/python2.7 #imports for parsing import urllib2 from bs4 import BeautifulSoup import json snapdeal="http://www.snapdeal.com" print "opening site :"+snapdeal #req=urllib2.Request("http://www.snapdeal.com/offers/best-discounts",headers={'User-Agent':"Magic Browser"}) #flip=urllib2.urlopen(req); #"http://www....
true
65a59d5150f77daeed370a0d2e6ad70007d98eee
Python
johnhungerford/hackerrank-solutions
/project-euler/prime-factors-binomial-coefficient.py
UTF-8
3,657
3.28125
3
[]
no_license
import sys all_primes = [2] # Cache of primes found so far (see gen_primes below) non_primes = {4:[2]} # Maps composites to prime factors def gen_primes(): # The running integer that's checked for primeness i = 0 q = 2 while True: if i < len(all_primes): yield all_primes[i...
true
6d4b352769fa443601861d1d5578aefbdea8382d
Python
kasteph/schemepy
/scheme_test.py
UTF-8
4,253
3.328125
3
[]
no_license
import unittest from parser import tokenize, parser, read from environment import Environment from evaluator import Evaluator class TestParser(unittest.TestCase): line = '((lambda(x) x) "Lisp")' def test_x(self): self.assertEqual(tokenize('x'), ['x']) def test_x_read(self): self.assertE...
true
97894fe3902d076924854cc8d2b0015bcde2efef
Python
vanpact/pyradius
/imageConverter.py
UTF-8
3,191
2.890625
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Oct 12, 2012 @author: yvesremi """ from PyQt4 import QtGui import numpy, cv2 import gc, sys, debugsp class ImageConverter(object): """Class to convert a numpy array to QImage and a QImage to a Numpy array.""" def __init__(self): """Construct...
true
c9f77eb3cd63f6b994cdcf334641066f370c188e
Python
mfong92/compbio
/nussinov/nussinov.py
UTF-8
2,383
3.609375
4
[]
no_license
#! /usr/bin/python import sys import random import re import time #timeStart = time.time(); #time check statement ''' Implementation of the Nussinov Algorithm given an input of RNA as either upper or lower case. Returns the number of maximum basepairs, assuming that there are no pseudoknots. Input format: python nu...
true
cf92713678353951de5c959551c0957b805bfac1
Python
Machele-codez/todo
/apps/tasks/forms.py
UTF-8
1,220
2.640625
3
[]
no_license
from .models import Task from django import forms from django.http import request import datetime, pytz class TaskForm(forms.ModelForm): due_date = forms.DateField(widget=forms.DateInput(attrs={'type': 'date'})) due_time = forms.TimeField(widget=forms.TimeInput(attrs={'type': 'time'})) class Meta: ...
true
e482aa24f3abe617c2590c7f6bd93de313223e36
Python
wewe89/Tools
/知识库.py
UTF-8
5,674
2.765625
3
[]
no_license
import xlrd import mysql.connector import re import string def connectdb(): print('连接到mysql服务器...') # 打开数据库连接 # 用户名:hp, 密码:Hp12345.,用户名和密码需要改成你自己的mysql用户名和密码,并且要创建数据库TESTDB,并在TESTDB数据库中创建好表Student config = { 'host': '127.0.0.1', 'user': 'root', 'password': '123456', 'port...
true
7101f3b4a37bc55891656437da8d73e15299cf2d
Python
RessCris2/algorithm020
/Week4/跳跃游戏.py
UTF-8
440
2.984375
3
[]
no_license
# 跳跃游戏 class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ reach = 0 n = len(nums) for i,x in enumerate(nums): if i <= reach: reach = max(reach, i+nums[i]) if reach...
true
373945d1b16a2081006d2fdeeb75c187ed2b06f5
Python
rack-leen/python-tutorial-notes
/chapter5_data_structures/list_queue.py
UTF-8
347
3.5625
4
[]
no_license
#!/usr/bin/env python # coding=utf-8 from collections import deque #被设计来从末尾更快速的append and pop元素 queue = deque(["Eric","Join","Michae"]) #从末尾增加元素 queue.append("Terry") print(queue) queue.append("Graham") print(queue) #从队列左边退出队列 queue.popleft() print(queue) queue.popleft() print(queue)
true
61d7226da68de2e20f027e6dc72076446b264971
Python
achuthasubhash/digital-makeup-using-opencv
/bread.py
UTF-8
1,971
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jun 25 08:00:26 2020 @author: DELL """ import cv2 import face_recognition from PIL import Image, ImageDraw import numpy jewel_img = cv2.imread("jewelery.png") frame = cv2.imread('priyanka.jpeg') frame = cv2.resize(frame,(432, 576)) #resize frame # Returns a...
true
236e3b07c2f127236715738b14ab82ecaa359046
Python
sciglio/Python-Scripts
/Function_fit.py
UTF-8
2,295
3.484375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jul 20 13:54:16 2018 @author: marco """ """FIT PROCEDURE IN PYTHON""" """VERSION 0.5""" #GENERATE RANDOM DATA import numpy as np # import math library np.random.seed(0) # Seed the random number generator for reproducibility x_data = np.linspace(-5, 5, num=50)...
true
3b428aa9bab973bb8da7d704e4d3a521ae3790fb
Python
harmsm/linux-utilities
/combine_data.py
UTF-8
1,759
3.296875
3
[ "Unlicense" ]
permissive
#!/usr/bin/env python __description__ = \ """ Combine a set of R-compatible files, re-indexing line counter and adding a column for the input file. All comments and blank lines are removed. The program assumes that each data file has a single-line header and a %10i first column containing line numbers. """ __autho...
true
de455dd6eede20d398af3a7b84fe2dc1f732bcac
Python
edgarinvillegas/deep-learning-v2-pytorch
/wasserstein-loss-gradient-2022/solution/tests.py
UTF-8
1,367
2.765625
3
[ "MIT" ]
permissive
from typing import Callable import torch FAKE_LOGITS = torch.tensor([-0.2990, 1.6582, 0.0880, -0.2078, 0.1899, 1.9609, 0.1763, 0.9490, -0.1863, 0.0479, -0.6072, 0.7648, 0.0189, 0.3165, 0.4645, -0.9585]) REAL_LOGITS = torch.tensor([-0.2219, 2.3058, -0.7330, -1.3858, -0.1590, ...
true
ec462f886cae35f0fcf779a5c37a45d440e0eab2
Python
csaddison/Physics-129L
/Homework_7/exercise1.py
UTF-8
2,158
3.265625
3
[]
no_license
#------------------------------------------------------------ # Conner Addison 8984874 # Physics 129L #------------------------------------------------------------ # Homework 7, Exercise 1 import math import numpy as np import matplotlib.pyplot as plt from scipy import optimize import ccHistStuff as cc # Loading dat...
true
1f5e932b52314df0b3d6ed1ab97db055312c511f
Python
cadbane/rfactor-udp
/pyfactor/hd44780.py
UTF-8
1,186
2.640625
3
[]
no_license
import RPi.GPIO as GPIO from time import sleep class HD44780: def __init__(self, pin_rs=7, pin_e=8, pins_db=[25,24,23,18]): GPIO.setwarnings(False) self.pin_rs = pin_rs self.pin_e = pin_e self.pins_db = pins_db GPIO.setmode(GPIO.BCM) GPIO.setup(self.pin_e, GPIO.OUT) GPIO.setup(self.pin_rs, GPIO.OUT) ...
true
cf095fb7330e279d18bc45c92e7ee35f59896405
Python
David-Papworth/Flask_practice
/flask_routes_excercise/app.py
UTF-8
305
3.03125
3
[]
no_license
from flask import Flask app = Flask(__name__) @app.route('/') @app.route('/home') def home(): return 'This is the home page' @app.route('/square/<int:number>') def about(number): return f'The square of {number} is {number**2}' if __name__ == "__main__": app.run(debug=True, host='0.0.0.0')
true
91543af6cbc4d2982d6b22b139b6bdc57219d7bb
Python
wkslearner/skill_advance
/parameter_advance/arg_parse.py
UTF-8
849
2.71875
3
[]
no_license
import argparse import pandas as pd from sklearn.datasets import load_iris from sklearn.cross_validation import train_test_split df=pd.DataFrame({'col1':[1,2,3,4],'col2':['a','b','a','c'],'col3':[7,8,9,10],'col4':[87,83,98,19]}) df=pd.pivot_table(df,index='col1',columns='col2',values=['col3','col4']).reset_index(level...
true
0afe6711476703df52b7a023a0123bbc154bc446
Python
jaime7981/Arduino_EFI
/EFI_map.py
UTF-8
1,111
2.796875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from matplotlib import colors rpms = np.array([4000,3500,3000,2500,2000,1500,1000,500]) throttle = np.array([0,0,10,20,40,60,80,100,120]) efi_map = np.array([[17.2, 16.8, 15.5, 14.8, 13.8, 13.0, 12.2], [17.0, 16.5, 15.0, 14.0, 13.4, 13.0, 12.4], ...
true
0b537dce803fc0ce2d760e611bbd7c2bd672cf45
Python
Jay23Cee/100_Day_Challenge
/Python/Merge_two_array.py
UTF-8
749
3.5
4
[]
no_license
def mergeArrays(arr1, arr2, n1,n2): i=0; j=0; k=0; arr3 = [None] * (n1+n2) while i < n1 and j < n2: if arr1[i] > arr2[j]: arr3[k] = arr2[j] j= j+1 k =k+1 elif arr1[i] < arr2[j]: arr3[k] = arr1[i] i =i+1 ...
true
91210c24d407cab9a2e323df32cab7e71d39f88f
Python
Incarnation/home_risk_competition_kaggle
/LightGbmOneFold/LightGbmOneFold.py
UTF-8
3,566
2.765625
3
[]
no_license
# coding:utf-8 import re import os import sys import numpy as np import pandas as pd from category_encoders import TargetEncoder from lightgbm import LGBMClassifier from sklearn.metrics import roc_auc_score np.random.seed(7) class LightGbmOneFold(object): def __init__(self, *, input_path, output_path): s...
true
a03a5db1b46461a8cadfea756fd6779974cc9b6d
Python
MaartenGr/KeyBERT
/keybert/_maxsum.py
UTF-8
2,287
3.421875
3
[ "MIT" ]
permissive
import numpy as np import itertools from sklearn.metrics.pairwise import cosine_similarity from typing import List, Tuple def max_sum_distance( doc_embedding: np.ndarray, word_embeddings: np.ndarray, words: List[str], top_n: int, nr_candidates: int, ) -> List[Tuple[str, float]]: """Calculate M...
true
5193cb544250d1c78a0fc63a44b507c2f6297bd0
Python
CORE-GATECH-GROUP/hydep
/src/hydep/internal/cram.py
UTF-8
6,946
2.96875
3
[ "MIT" ]
permissive
""" Shadow of OpenMC CRAM solvers Inspired and, in some places, copied from OpenMC Copyright: 2011-2020 Massachusetts Institute of Technology and OpenMC collaborators https://docs.openmc.org https://docs.openmc.org/en/stable/pythonapi/deplete.html https://github.com/openmc-dev/openmc """ import numbers import numpy...
true
40313fa1029d5146bd1db0dd8857c60f6f5583d8
Python
chinitacode/Python_Learning
/Concurrent_Programming/multhread/Daemon/test_daemon.py
UTF-8
1,865
4.09375
4
[]
no_license
''' 如果你设置一个线程为守护线程,,就表示你在说这个线程是不重要的,在进程退出的时候,不用等待这个线程退出。 如果你的主线程在退出的时候,不用等待那些子线程完成,那就设置这些线程的daemon属性。 即,在线程开始(thread.start())之前,调用setDeamon()函数,设定线程的daemon标志。 (thread.setDaemon(True))就表示这个线程“不重要”。 如果你想等待子线程完成再退出,那就什么都不用做。 或者显示地调用thread.setDaemon(False),设置daemon的值为false。 新的子线程会继承父线程的daemon标志。 主线程会在所有的非守护线程退出后才...
true
84f6519b65e3978b5a68e9e5f14b3d7873701555
Python
catrina-brunkow/RA_Boyce_Astro
/tool/forms.py
UTF-8
2,507
2.75
3
[]
no_license
from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, IntegerField, SelectField, FloatField, RadioField from wtforms.validators import Optional, NumberRange, Regexp class QueryForm(FlaskForm): ''' QueryForm class Used to generate a form with various fields that work as filters for ...
true
a84b8449fcb995a9606f56cd782e8e07c4c91e7b
Python
IdrisovRI/python_test_application_backend
/helper/validate.py
UTF-8
248
2.890625
3
[]
no_license
class PackageDataValidator(object): @staticmethod async def validate(package: str): result = False if "Symbol" in package and "Bid" in package and "Ask" in package: result = True return result
true
a374ae6b0f0d910c0d009ff9527102d2a844629b
Python
LuckyTiger66/py-scraping-analysis-book
/ch5/sqlite.py
UTF-8
1,334
3.1875
3
[ "MIT" ]
permissive
import sqlite3 import csv def execute_db(fname, sql_cmd): conn = sqlite3.connect(fname) c = conn.cursor() c.execute(sql_cmd) conn.commit() conn.close() def select_db(fname, sql_cmd): conn = sqlite3.connect(fname) c = conn.cursor() c.execute(sql_cmd) rows = c.fetchall() conn.c...
true
d7bbb36fd22d0cdbb9faffdd04f7206c16448f8e
Python
pluemthnn/ITCS451-AI
/assign1/checkpoint1.py
UTF-8
1,462
3.21875
3
[]
no_license
import numpy as np from hw1.envutil import gen_maze, render_maze from hw1.pathfinding import MazeState, TreeNode from hw1.pqueue import SimplePriorityQueue maze1 = gen_maze(10, add_mud=True) state1 = MazeState(maze1) print(render_maze(maze1)) # try to perform action: for action in state1.actions: print('-' * 5...
true
d09b14129c9aca67d2611b6ff8ca0223aaae381a
Python
deangroom/Demo-JSON
/main.py
UTF-8
543
3.046875
3
[]
no_license
import json with open('Stats.json') as stats: #data = json.load(stats) print(data) Strength = input("How much strength? ") data["Strength: "] = Strength Constitution = input("How much constituion? ") data["Constitution: "] = Constitution Dexterity = input("How much Dexterity? ") data["Dexterity: "] = Dexterity Intell...
true
a7cf226615af2e28fac60db046d5b8d5c17cda41
Python
FionnMarf/ProjectEuler
/Euler003.py
UTF-8
1,069
3.6875
4
[]
no_license
import math as math #Need a reasonably efficient (sub exponential?) factorization algorithm for the largest prime factor #ideas #begin at sqrt(n) and work backwards until a prime factor is found (still exponential) def factorize(n): #finished = False new = math.floor(math.sqrt(n)) print new ...
true
99c426825645e581d9cb83d07fadccc5bdf954a8
Python
RasaHQ/rasa
/rasa/core/evaluation/marker_tracker_loader.py
UTF-8
3,658
2.796875
3
[ "LicenseRef-scancode-generic-cla", "Apache-2.0", "MIT" ]
permissive
import random from rasa.shared.exceptions import RasaException from rasa.shared.core.trackers import DialogueStateTracker from typing import Any, Iterable, List, Text, Optional, AsyncIterator from rasa.core.tracker_store import TrackerStore import rasa.shared.utils.io STRATEGY_ALL = "all" STRATEGY_FIRST_N = "first_n" ...
true
cf1a659cf8fa34bb193b6eaece5f58043f417497
Python
wgolling/BreathOfFire3Notes
/scripts/objects/test_datatracker.py
UTF-8
15,621
2.921875
3
[]
no_license
from datatracker import * import unittest # # # Enums class TestCharacter(unittest.TestCase): def test_character_enum(self): assert(Character) assert(len(list(Character)) == 7) class TestSkillInk(unittest.TestCase): def test_skill_ink_enum(self): assert(SkillInk) assert(len(list(SkillInk)) == ...
true
b6f9ca285f6f99f1f5f18a9d30afd3e3908340fd
Python
geometer/sandbox
/python/sandbox/rules/abstract.py
UTF-8
2,759
2.625
3
[ "Apache-2.0" ]
permissive
class AbstractRule: @classmethod def priority(clazz): return 2 class SyntheticPropertyRule(AbstractRule): __instance = None @staticmethod def instance(): if SyntheticPropertyRule.__instance is None: SyntheticPropertyRule.__instance = SyntheticPropertyRule() retu...
true
f4707040c0b2aa51cfb2e2926293ee883fece27a
Python
sayan1995/BFS-2
/problem3.py
UTF-8
1,154
3.625
4
[]
no_license
''' Iterative: Time Complexity: O(n) Space Complexity: O(n) Did this code successfully run on Leetcode : Yes Explanation: Add all the elements to the hashmap and use bfs using queue to iterate through the hashmap and add importance ''' """ # Employee info class Employee: def __init__(self, id: int, importance: i...
true
a764af339e51c416b5018cf854989fcfe2cba63d
Python
DTuscher/TA
/driveur.py
UTF-8
747
2.578125
3
[]
no_license
import urx from time import sleep rob = urx.Robot("172.16.174.128") rob.set_tcp((0, 0, 0.1, 0, 0, 0)) rob.set_payload(2, (0, 0, 0.1)) rob.set_simulation(True) sleep(0.2) #leave some time to robot to process the setup commands #rob.movel((0,0,0.1,0,0,0), relative=True) try: l = 0.05 v = 0.05 a = 0.3 ...
true
d8df627b266082ef08ba975f27733c253cd5d26f
Python
richardmitic/waview
/waview/waview.py
UTF-8
12,667
2.6875
3
[]
no_license
#!/usr/bin/env python3 import curses import sys import argparse import logging import wave import numpy as np from scipy.io import wavfile from scipy.signal import resample INT16_MAX = int(2**15)-1 LOG = logging.getLogger("waview") SAMPLE_FORMATS = { "S16_LE": np.int16 } def log_call(func): ret = None ...
true
f2f462185a604beaf2364d558906c591fc834f5f
Python
IlidanNaga/317_Hometask_Practicum
/Big_task_1/completing_task_2.py
UTF-8
2,003
2.984375
3
[]
no_license
from cross_validation import knn_cross_val_score from cross_validation import kfold from sklearn.datasets import fetch_mldata from random import seed from random import shuffle import numpy as np # part_2 mnist = fetch_mldata("MNIST-original") data = mnist.data / 255.0 target = mnist.target.astype("int0") # после...
true
fd3ed4e46570584aa95f908dcd533885f7f9ff8b
Python
abhayprakash/competitive_programming
/spoj/BISHOPS-5354458-src.py
UTF-8
93
2.984375
3
[]
no_license
try: while 1: n=int(raw_input()) if n==1: print 1 else: print 2*(n-1) except:0
true
79aea6a6a2e4984da3c648fda977b87feac4f8b1
Python
alexnwang/SketchEmbedNet-public
/util/utils.py
UTF-8
4,565
2.515625
3
[]
no_license
import os import numpy as np import tensorflow as tf from multiprocessing import Process, Queue from PIL import Image from .quickdraw_utils import stroke_three_format, scale_and_rasterize def process_write_out(write_fn, fn_args, max_queue_size=5000): """ Begins a parallelized writer that run...
true
1bc4d43c44fbe332748fa7b743adc3b647dca9fd
Python
phrodrigue/URI-problems
/iniciante/1005/main.py
UTF-8
107
3.140625
3
[]
no_license
n1 = float(input()) n2 = float(input()) media = (n1 * 3.5 + n2 * 7.5) / 11 print(f"MEDIA = {media:0.5f}")
true
5bbcf2a37e2e39247e3efd46b5699262e671a043
Python
rusianh/cours_python_basic_advance_dllt
/Unit7. FileIO - List/40.list.py
UTF-8
394
3.875
4
[]
no_license
colors = ["red", "green", "blue"] print(colors) print(colors[0]) print(colors[1]) print(colors[2]) print(len(colors)) colors.append("yellow") print(colors) print(colors[3]) for i in range(4): #hard code: nên đổi 4 = len(colors) vì biết đây là 4 print(colors[i]) last_index = len(colors) - 1 print(colors[-1]) #...
true
69d59e3f864b7181e836fcbc39236eefc16fa1db
Python
GJumge/lab01
/strings.py
UTF-8
203
3.140625
3
[]
no_license
strings = ['This', 'list', 'is', 'now', 'all', 'together'] sentence = '' #sentence = 'yo ' + 'hello' #print(sentence) for word in strings: sentence = sentence + ' ' + word print(sentence[1:])
true
29516da2744665313717d7cf4229e0f352a81297
Python
pedrorault/discordBot
/ballBot/ballCog.py
UTF-8
1,456
2.859375
3
[]
no_license
import discord from discord.ext import commands from ballBot.ball import randomResponse import random class BallCog(commands.Cog): def __init__(self,bot): self.bot = bot @commands.command(name='8ball') async def _8ball(self,ctx): msg = randomResponse() await ctx.send(msg) ...
true
1cfbed4f3226e8f697dd8ad78f2c5bcaad95dc16
Python
ORNL/AADL
/model_zoo/TestFunctions_models.py
UTF-8
1,736
2.84375
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 7 10:30:19 2020 @author: 7ml """ import torch ############################################################################### class Paraboloid(torch.nn.Module): def __init__(self, dim, condition_number=1.e3, device='cpu'): super()._...
true
556e661d7e79e28fbe563e37c0f17babc7b8ea73
Python
pcidale/coffee-shop-udacity
/backend/src/api.py
UTF-8
4,473
2.515625
3
[]
no_license
from flask import Flask, request, jsonify, abort import json from flask_cors import CORS from .database.models import db_drop_and_create_all, setup_db, Drink from .auth.auth import AuthError, requires_auth app = Flask(__name__) setup_db(app) CORS(app) ''' @TODO uncomment the following line to initialize the database...
true
3d3757e11b539c07dc8059de34ae4ceacda5a5f7
Python
BrunoAfonsoHenrique/CursoEmVideoPython
/AlgoritmosPython_parte1/059.py
UTF-8
136
4.09375
4
[]
no_license
num = int(input('Digite um numero: ')) if num % 10 == 0: print('É divisivel por 10.') else: print('Não é divisivel por 10.')
true
c267cd41680d406de0d2562950877552b492276f
Python
dw/py-bulksms
/old/Commander.py
UTF-8
2,511
2.796875
3
[]
no_license
""" BulkSMS/Commander.py: Interactive curses interface to BulkSMS. """ __author__ = 'David Wilson' import os, time, sys import curses, curses.textpad import BulkSMS, BulkSMS.PhoneBook def real_interactive(screen): ''' Act as an interactive curses application. This is called from curses.wrapper. ''' screen.era...
true
3ee925dd40e12495e1aa1aeeb8bfc4a8e52462c9
Python
ipcoo43/algorithm
/lesson170.py
UTF-8
275
3.53125
4
[]
no_license
print('''메모리공간을 동적으로 사용하여 데이터 관리하기''') total=0 num = int(input('입력 할 수 >> ')) for i in range(num): data = int(input('{} 번 점수 ? '.format(i+1))) total += data print('총점 = {}, 평균 = {}'.format(total, total//num))
true
782ba656b72436b57e36bbe663db8e805e7c816b
Python
zivadinac/pmf-master
/src/utils.py
UTF-8
2,512
2.734375
3
[]
no_license
"""Utility functions and variables""" import tensorflow as tf import gym import numpy as np from skimage.transform import resize from skimage.color import rgb2grey, gray2rgb import matplotlib.pyplot as plt import time import pickle def getTerminalStates(env): """ Get terminals states of a given env. """ pS = e...
true
64db8a8fa4f5b764cc488d884eaa9d7101fcf1b8
Python
harshilpatel312/dbgame
/background.py
UTF-8
842
3.71875
4
[]
no_license
import pygame class Background: # scrolling background logic: https://www.youtube.com/watch?v=PjgLeP0G5Yw def __init__(self, image): self.bg = pygame.image.load(image) self.bg_x = 0 # position of first background image self.bg_x2 = self.bg.get_width() # position of second background ...
true
b479ea2025f8d3d427fa045df67325c83d2f0faf
Python
MarkDM/red-python-scripts
/windows10-wifi_ptBr.py
UTF-8
1,159
2.671875
3
[ "MIT" ]
permissive
import subprocess import re command_output = subprocess.run( ["netsh", "wlan", "show", "profiles"], capture_output=True).stdout.decode(encoding='iso-8859-1') profile_names = (re.findall(r"[^:|\s]+$", command_output, flags=re.MULTILINE)) wifi_list = [] if len(profile_names) != 0: for name in profile_names...
true
47bf658db25a11f27909ad69fb9b3d0006958752
Python
AufzumAtem/ItProg
/IT Prog 2/2.3.py
UTF-8
1,320
3.59375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Mar 2 13:14:00 2018 @author: Romeo """ class bankaccount: def __init__(self, currency, first , last): self.first = first self.last = last self.balance = 0 self.currency = currency def deposit(self, amount): if amount ...
true
8464f88da72e5d80e9d3f3b3dad37faed276a841
Python
SIMELLI25/esercizi_python
/pasta.py
UTF-8
2,359
2.640625
3
[]
no_license
from spalla import Verifica Verifica.firma("Simone Melli") #Verifica.stampa_esercizi() #Verifica.stampa_voto() ''' es = Verifica.inizia_esercizio(1) print(es) print(es.dati) es.consegna(es.dati.lower()) ''' ''' es = Verifica.inizia_esercizio(2) print(es) print(es.dati) es.consegna(es.dati*es.dati) ''...
true
e98702cbadbb064f457b83a89be85cb7b80a1cc8
Python
RFloTeo/RoboStuff
/test.py
UTF-8
480
2.828125
3
[]
no_license
import brickpi3 import time BP = brickpi3.BrickPi3() turn_dps = 100 move_dps = -100 def TurnLeft(): BP.set_motor_dps(BP.PORT_A, turn_dps) BP.set_motor_dps(BP.PORT_B, -turn_dps) time.sleep(1.42) BP.reset_all() try: for i in range(4): BP.set_motor_dps(BP.PORT_A, move_dps)...
true
72c137ae0e8b5ea65f28765935993b1482212976
Python
wheatmushi/projectEuler
/euler_021 (Amicable numbers).py
UTF-8
427
3.171875
3
[]
no_license
from math import ceil, sqrt def d(n): div = [1,] for i in range(2,ceil(sqrt(n))+1): if n%i == 0: div.append(i) div.append(int(n/i)) return sum(div) maximum=10000 amicables=[] n_div={} for n in range(1,maximum): n_div[n] = d(n) for n in range(1,maximum): if n_div[n...
true
eb0a19c684bbcbc0236d8077667dd08d93ee711b
Python
lobhaum/python
/py2zumbis/arquivoPratica01.py
UTF-8
160
3.296875
3
[]
no_license
f = open('arquivoPratica01.txt', 'w') f.write('Gravando uma única linha no arquivo') for l in range(1, 101): f.write(f'Gravando a linha {l} \n') f.close()
true
44620fbe6ec751547c32650876eef0f6e0f32bf0
Python
PraneshASP/LeetCode-Solutions-2
/904 - Fruit into Baskets.py
UTF-8
3,028
3.4375
3
[]
no_license
# Solution 1: Relatively straight forward, just make sure to handle all the edges cases class Solution(object): def totalFruit(self, tree): """ :type tree: List[int] :rtype: int """ fruit_one = 0 fruit_one_type = None fruit_two = 0 fruit_two_type = Non...
true
b89127dbc34619542e8db0960036d3c05ad66529
Python
grchristensen/django-app
/functional_tests.py
UTF-8
551
2.984375
3
[]
no_license
from selenium import webdriver import unittest class TestToDo(unittest.TestCase): def setUp(self): self.browser = webdriver.Firefox() def tearDown(self): self.browser.quit() def test_can_start_a_list_and_retrieve_it_later(self): # Bob has heard about this awesome new to-do app. ...
true
327af45312be5354133bbb7c1cc271667680c660
Python
silky/bell-ppls
/env/lib/python2.7/site-packages/observations/r/monica.py
UTF-8
2,200
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def monica(path): """WHO Monica Data The `monica` data frame has 6357 ...
true
c0437c7405b57b734606c9a48135291d1b0651a8
Python
hitanshkadakia/cool_text_making
/cooltext.py
UTF-8
208
2.75
3
[ "Apache-2.0" ]
permissive
import os from pyfiglet import Figlet def cool(text): cooltext=Figlet(font="slant") os.system("cls") return str(cooltext.renderText(text)) if __name__ == "__main__": print(cool("Happy_coding01"))
true
40c58a95ba8611443dbb3c78d1bd7bf9142465b8
Python
mentecatoDev/python
/diccionarios/03.py
UTF-8
554
3.828125
4
[]
no_license
""" Ejercicio 03 Escribir un programa que lea un log de correo construya un histograma usando un diccionario para contar cuántos mensajes se recibieron de cada dirección de correo electrónico y visualice los resultados. """ try: fhandle = open(input("Introduzca el nombre del fichero: ")) except IOError: print...
true
66aa4c6e162ffcaefa351728e6020354bc658815
Python
AIRI-Institute/GENA_LM
/downstream_tasks/promoter_prediction/dataset_generator.py
UTF-8
1,703
2.859375
3
[ "MIT" ]
permissive
from Bio import SeqIO import numpy as np import pandas as pd np.random.seed(42) print('Please, input fasta filename: ') path = input() ind = path.find('len') name = path.split('.')[0] length = name[ind:] count = 0 sequences = [] # Here we are setting up an array to save our sequences for the next step for seq_record...
true
fc932596eaa40b26550dad42f2ae3eaeb8f829bb
Python
JaneHQ1/Path-to-Python3-v2
/thirteen/c1.py
UTF-8
988
3.078125
3
[ "MIT" ]
permissive
""" 13-1 分析抓取目的确定抓取页面 """ # 我们做的爬虫只是功能非常简单的案例,不是一个完整的爬虫。 # 一个完整的爬虫非常复杂,反扒机制,自动登陆,代理IP等辅助功能非常繁琐。 # 这个案例没有利用任何爬虫框架,纯粹依靠之前学习过的知识来做数据的爬取。 # 爬虫小案例目标: # 巩固之前学习的知识 # 学习合理编码的规范和方式 # 了解爬虫的基本原理 # Step 1 # 写爬虫一定要知道目的是什么,才能很好地去写爬虫。因为网络上数据和信息量非常大。 # 目标:爬熊猫TV英雄联盟分类下面主播人气排行。 # 怎么爬? # 我们要的数据都在网站上,如何将数据抓取到自己的程序里? # Step 2 # 充分了解网站结...
true
a65f7a30c2b65ebfea3a0d1e834497766c2b0f51
Python
IvanWoo/coding-interview-questions
/puzzles/same_tree.py
UTF-8
956
3.703125
4
[]
no_license
# https://leetcode.com/problems/same-tree/description/ """ Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. Example 1: Input: p = [1,2,3], q = [1,2,3] Outp...
true
0440473de32317a2a441c2c88efe29710497f744
Python
dla1434/book_python_effective_flow_control
/chapter5/multiprocessing/daemon_process_join.py
UTF-8
400
2.640625
3
[ "Apache-2.0" ]
permissive
################################### # File Name : daemon_process_join.py ################################### #!/usr/bin/python3 import time import multiprocessing def daemon(): print ("Start") time.sleep(5) print ("Exit") def main(): d = multiprocessing.Process(name="daemon", target=daemon) d.da...
true
b5b5924bd82f8a79c13c04a16ee2ef1901f89589
Python
rigved-sanku/Covid-19-Prediction
/initializations.py
UTF-8
808
2.703125
3
[]
no_license
import numpy as np class Layer: def __init__(self,no_layers,num_nodes:list,activation:list): self.layers=no_layers self.nodes=num_nodes self.activation=activation self.params=self.intialize_weight() self.grads={} def intialize_weight(self): np.r...
true
2db7dbd201fe3c70b1f593d27383d3422ad7342c
Python
humuhimi/wkwk_nlp
/Chapter2/excecise2_7__.py
UTF-8
1,507
3.40625
3
[]
no_license
""" 16. ファイルをN分割する 自然数Nをコマンドライン引数などの手段で受け取り,入力のファイルを行単位でN分割せよ.同様の処理をsplitコマンドで実現せよ. 1.分割するファイル数を入力 2.分割ファイル数より分割行数を計算する 3.リストから分割行分別ファイルに書き込み 書き込んだ分はリストから削除する 3.5リストのループを終わらせる。 4.最後分割数以下のファイルを全て書き出す。(残ったリストを全て書き出す) """ # import math # with open(path) as file: # lines = data.readlines() # count = len(lines) # un...
true
a239c5b64aedbbddc0506934e0719cc6f7b9133b
Python
zakkitao/python-turtle-for-fun
/用turtle画python的logo.py
UTF-8
1,684
3.125
3
[]
no_license
import turtle as t t.getscreen().bgcolor("black") t.setup(650,350,200,200) t.pensize(15) t.pencolor("yellow") t.hideturtle() t.speed(10) #p t.pu() t.goto(-150,50) t.pd() t.seth(-90) t.forward(110) t.pu() t.goto(-150,0) t.seth(-30) t.pd() t.forward(15) t.circle(25,120) t.forward(30) t.seth(110) t.ci...
true
4ca0b6d157002a34a16a08333719560fa23f1785
Python
iTrauco/list_exercises
/hello_python/loop_choose.py
UTF-8
574
3.8125
4
[]
no_license
whole_game = True while whole_game: stil_playing = True while stil_playing == True: try: user_number = int(input('Give me a number ')) if user_number == 3: print('Well done') stil_playing = False else: print('Try again'...
true
942df48c51d298b43b216782297c6e23f9615c47
Python
patilakshay227/Complex-Term-Project
/sectionExtract.py
UTF-8
1,749
2.671875
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Mar 8 20:45:43 2018 @author: Ashwin """ import simplejson as json import pickle import datetime import sqlite3 import traceback import os import dateutil.parser as dp if os.path.exists("sectionintegritylog"): os.remove("sectionintegritylog") inp...
true
de1784513fcb81341213164df6f9824bf80d74b7
Python
compjour/compjour-class-site
/source/files/code/answers/json-quiz/5.py
UTF-8
833
3.125
3
[]
no_license
import requests import json data_url = 'http://www.compjour.org/files/code/json-examples/single-tweet-librarycongress.json' data = json.loads(requests.get(data_url).text) print('A.', data['created_at']) print('B.', data['user']['created_at']) print('C.', data['text']) print('D.', data['user']['screen_name']) print('E....
true
27c0e344ba4da1d22e7aac1c3f6b0a644982c19c
Python
PratikshaDanti/APS
/Code Library/111.Self_dividing_numbers.py
UTF-8
613
3.5625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Apr 1 10:48:20 2020 @author: Pratiksha """ def selfDividingNumbers(left,right): l1=[] for i in range(left,right+1): s=str(i) if '0' in s: continue l=[] for ele in s: l.append(int(ele)) f...
true
5604a9a252ac2f69d5160ba563dd8f7e4c222d98
Python
dyf102/LC-daily
/binary-search/python/minimum-limit-of-balls-in-a-bag.py
UTF-8
726
3.4375
3
[]
no_license
class Solution: def minimumSize(self, nums: List[int], maxOperations: int) -> int: """LC 1760. Minimum Limit of Balls in a Bag Args: nums (List[int]): [description] maxOperations (int): [description] Returns: int: [description] """ ...
true
4fa0eb2c306b95241dc939046e1801d0c203ea28
Python
svmyhome/ToDoProg
/count_letter.py
UTF-8
311
3.578125
4
[]
no_license
word_list = ['python', 'c++', 'c', 'scala', 'java'] l_task = input('Введите букву: ') def count_letter(letter, word_list): result = 0 for word in word_list: if l_task in word: print(word) result += 1 return result print(count_letter(l_task, word_list))
true
da59716d09afbababa736a1b81d07fa783578749
Python
Nesqwik/SVL
/TP3/carte.py
UTF-8
2,650
3.546875
4
[]
no_license
import caisse from caisse import SoldeInsuffisantError from caisse import NbTicketInsuffisantError class Carte: def __init__(self, solde, nb_ticket, prix_ticket): ''' Permet d'instancier une carte avec : solde / nombre de tickets / prix du ticket >>> c = Carte(42,10,7) ...
true
9d34133cc54538b8e471cf9cb837f72f02253c24
Python
jennac/candidate_classifier
/splitfile.py
UTF-8
1,843
3.015625
3
[]
no_license
from argparse import ArgumentParser from csv import DictReader, DictWriter def get_args(): parser = ArgumentParser(description='splits infile into n smaller chunks') parser.add_argument('-f', '--filename', help='file to import and split') parser.add_argument('-n', '--number', ...
true
cfa81530171b7ca0c9d735e36ea8cab2bab61035
Python
PeterKoka1/SP500_Twitter_Sentiment_Compiler
/daily_update.py
UTF-8
3,567
3.09375
3
[]
no_license
""" The script that will update (i.e., append a new row) the SPX_sentiment.csv file based on today's date """ import requests import bs4 as bs import pickle import datetime import pandas as pd import warnings from twitter_scraper_api import SPX_Twitter_Scraper class Daily_Update(object): def __in...
true
34666e6cbe79a31db8d854adf5bb45a39e932661
Python
DiliaoM/metaphor-recognition
/sen-embedding.py
UTF-8
4,902
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Mar 29 15:05:44 2018 @author: Miranda """ import tensorflow as tf from numpy.random import RandomState import xlrd import matplotlib.pyplot as plt import numpy as np import os import xlsxwriter from tensorflow.contrib import rnn # 重置 tf.reset...
true
b1f46446034177239f960268921d933eb471305f
Python
rivereasterling/Space-Invaders-with-a_Twist
/thetestCase.py
UTF-8
998
3.0625
3
[]
no_license
import unittest from Lab10 import Laser from Lab10 import Player from Lab10 import Ship from Lab10 import Enemy from Lab10 import collide class All_Test(unittest.TestCase): def test_will_work(self): pass #the above test wouldn't work for me so I know that somethings up with how pycharm does unit tests in p...
true
fca1ac8f599bba174ecc1222b05cea867d669fa6
Python
zhenchentl/Machine_Learning
/datatest20151218.py
UTF-8
486
2.546875
3
[]
no_license
#coding=utf-8 #注意现在还是没有解决中显示乱码的状况 import pandas as pd #from scipy import stats as ss import matplotlib.pyplot as plt csvfile=file('d:\Pycharm\\forpython.csv','rb') df=pd.read_csv(csvfile) print df.head() print df.columns print df.index print df.ix[:].head(4) print df.describe() #print ss.ttest_1samp...
true
d816cb5cbe65c466b8d40cc985720e415e787bf8
Python
alineat/python-exercicios
/desafio051.py
UTF-8
416
4.21875
4
[]
no_license
# Desenvolva um programa q leia o primeiro termo e a razão de uma PA. No final, mostre os 10 primeiros termos dessa # progressão. print('=' * 6, '10 TERMOS DE UMA PA', '=' * 6) pri = int(input('Primeiro termo: ')) ra = int(input('Razão: ')) decimo = pri + (10 - 1) * ra #formula matematica para saber qual o 10º termo f...
true
960a7c00c4725b38e4923b85cc0d19629f4e5192
Python
shhuan/algorithms
/leetcode/easy/CountandSay.py
UTF-8
1,262
3.6875
4
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ created by huash at 2015-04-11 19:11 The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one 2, then one 1" or 1211. Given an integer n, generate the ...
true
67009179574febaacd2329500b1af39ca421c37b
Python
rasooll/Python-Learning
/mian-term/barname2-adad-aval.py
UTF-8
473
3.6875
4
[]
no_license
# Type your code here def list_of_primes(n): def isprime(r): r = abs(int(r)) if r < 2: return False if r == 2: return True if not r & 1: return False for x in range(3, int(r**0.5)+1, 2): if r % x == 0: return False return True #print...
true
51c6c113c03407b6eccb2d59338fa25231ff138c
Python
sibis-platform/ncanda-data-integration
/datadict/datadict_update.py
UTF-8
5,598
2.8125
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # """ # Given a CSV with the current data dictionary and a list of patch files with # updated / newly inserted variables, produce a full patched data dictionary. # """ from __future__ import print_function from __future__ import absolute_import import sys import pandas as pd import csv import argp...
true
e49083ded17e4a107419d1467593ba06b21d6387
Python
finiteV/backuptool
/dbman.py
UTF-8
3,703
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- import sqlite3 class DBMan(): def __init__(self,dbname): ''' 只进行一次 ''' self.dbname = dbname+'.db'; self.conn = sqlite3.connect(self.dbname,check_same_thread = False); self.conn.text_factory = bytes#解决中文出错 #if not exits, create it ...
true
72382a9c63d92b144ca635258abd48e14b221c5e
Python
drtierney/hyperskill-EasyRiderBusCompany-Python
/Easy Rider Bus Company/task/easyrider/easyrider.py
UTF-8
2,142
2.953125
3
[ "MIT" ]
permissive
import json import re all_keys = ['bus_id', 'stop_id', 'stop_name', 'next_stop', 'stop_type', 'a_time'] format_keys = ['stop_name', 'stop_type', 'a_time'] type_error_counter = dict.fromkeys(all_keys, 0) format_error_counter = dict.fromkeys(format_keys, 0) bus_id_values = {128, 256, 512} stop_name_regex = r'[A-Z]\w+\s?...
true
8767d2baae90d75e3fa37c7f86c411686a676e5c
Python
thisisparthjoshi/Basic-Programs
/factorial.py
UTF-8
187
3.890625
4
[]
no_license
n=int(input("Please enter any number here--")) Prod =1 for i in range (1, n): Prod = Prod * n n=n-1 print (" The factorial is:", Prod) print (" The Value of N is:", n)
true
cc57d1fb8d19c971fb5e7be5093240e22ca0e7cd
Python
vincentmartin/m1la-python
/c3_3_fonctions.py
UTF-8
3,835
4.125
4
[]
no_license
# -*-coding:utf-8 -* ''' Created on 13 mars 2014 @author: vincent Cours 3. : Fonctions. ''' ####################################### # 1. Définition et utilisation de fonctions. ####################################### # Définition d'une fonction qui affiche bonjour. # 0 paramètres, pas de valeur de retour. def bonjou...
true
5d6aa84e048957f706f197d529c1d80928700547
Python
gregnordin/parampool
/parampool/utils/__init__.py
UTF-8
7,305
2.78125
3
[]
no_license
def legal_variable_name(name): """ Make a variable name from the string name. Replace space by underscore and remove all illegal characters in a Python variable name. """ var_name = name.replace(' ', '_').replace('/', '__') for char in r'''[]{}\^%$#@!+-<>?|'"=~`,.;:''': if char in va...
true
6aa9fda03c5980cad1529b6f2f5bebef07fc38db
Python
YuriyKozhev/PythonCourse
/Lecture_8/fast_mode.py
UTF-8
1,285
3.453125
3
[ "MIT" ]
permissive
import itertools def puzzle_input() -> dict: with open('input.txt') as f: return { layer: range_ for layer, range_ in ( map(int, row.strip().split(': ')) for row in f)} def calc_scanner_pos(scanner_height: int, time_step: int) -> int: """ Calculates the po...
true