blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f76b3b840b3db0b3d8c980dc620327745383a006 | Python | 17BTEC005/virat-kohli | /rohit sharma.py | UTF-8 | 135 | 3.03125 | 3 | [] | no_license | #multiply 2 no.s
a=10
b=20
c=a*b
print("multiplication of 10 and 20",a,"*",b,"=", c)
| true |
8b1781f3d1abb887e332ddcd453bef5c9b05fa8d | Python | ravitejavemuri/ML-Algorithms | /K-means/k-means.py | UTF-8 | 2,282 | 3.546875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 18 13:13:09 2019
Psudo :
1.Get a Dataset
2.arbitarily choose K centroids in random
3.Assign the closest data points by distance to a centroid/cluster
4.Compute mean of the datapoints in the clusters excluding the centroids
5.The mean would be... | true |
cb74f99d17f6f3e2d592fe812390f6036acfd879 | Python | Elcoss/Python-Curso-em-Video | /Mundo1/desafio6.py | UTF-8 | 159 | 3.59375 | 4 | [] | no_license | n1=int(input('digite seu numero: '))
n2= n1*2
n3= n1*3
n4= n1**(1/2)
print(f'o dobro do seu numero e {n2} o triplo e {n3} a raiz quadrada dele e {n4}')
| true |
e1c8441b35d68c6c440ce5d1359a7d254a953005 | Python | ursho/Project-Euler | /tests/testFibonacciGenerator.py | UTF-8 | 1,217 | 3.625 | 4 | [] | no_license | import unittest
from problems.FibonacciGenerator import FibonacciGenerator
class TestFibonacciGenerator(unittest.TestCase):
def test_Fibonacci(self):
self.assertEqual(0, fibonacci(1))
self.assertEqual(1, fibonacci(2))
self.assertEqual(1, fibonacci(3))
self.assertEqual(2, fibonacci(... | true |
3707c418d6dce0abd30f17853a48ef57190a93fd | Python | j1fig/euler | /16/main.py | UTF-8 | 230 | 2.609375 | 3 | [] | no_license | import sys
import cProfile
def brute(arg):
return reduce(lambda x, y: x + int(y), str(2**arg), 0)
if __name__ == "__main__":
arg = int(sys.argv[1])
def main():
print brute(arg)
cProfile.run('main()')
| true |
cc6979eb902a306740989885480d0063a98bc1fd | Python | SUREYAPRAGAASH09/ArrayQuestions | /25.2ndSmallestNumber/2ndSmallestNumber.py | UTF-8 | 261 | 3.109375 | 3 | [] | no_license | import find_min
def secondsmallestNumber(array):
v = find_min.findMin(array)
for i in array:
if v == i:
array.remove(i)
maxi = find_min.findMin(array)
return maxi
array = [3,1,6,9,3]
print(secondsmallestNumber(array)) | true |
dddccee9cd8d45f0702060530c95388c1656c218 | Python | Catxiaobai/project | /lxd_Safety(out)/graphTraversal-submit2/mymodules/sclexer.py | UTF-8 | 2,844 | 2.671875 | 3 | [] | no_license | # An lexer for simple C Langrage
import lex
#from ply import *
reserved = (
# 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE',
# 'ELSE', 'ENUM', 'EXTERN', 'FLOAT', 'FOR', 'GOTO', 'IF', 'INT', 'LONG', 'REGISTER',
# 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', 'SW... | true |
cad792f0c8f6a47486fa4d6fe971ec48089dbe00 | Python | syurskyi/Python_Topics | /115_testing/_exercises/_templates/temp/Github/_Level_1/Python_Unittest_Suite-master/Python_Unittest_Patch_Methods.py | UTF-8 | 2,885 | 3.46875 | 3 | [] | no_license | # Python Unittest
# unittest.mock � mock object library
# unittest.mock is a library for testing in Python.
# It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used.
# unittest.mock provides a core Mock class removing the need to create a host of stu... | true |
7a6db244d6501882789016473d740863701e660a | Python | jcmarsh/drseus | /scripts/socket_file_server.py | UTF-8 | 2,401 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
from socket import AF_INET, SOCK_STREAM, socket
from threading import Thread
from os import remove
def receive_server():
with socket(AF_INET, SOCK_STREAM) as sock:
sock.bind(('', 60124))
sock.listen(5)
while True:
connection, address = sock.accept()
... | true |
e8669d2f92a66e62d55904b67217aba188e06c20 | Python | kevinqqnj/sudo-dynamic-solve | /sudo_recur.py | UTF-8 | 18,986 | 3 | 3 | [
"Apache-2.0"
] | permissive | # coding:utf-8
# python3
# original: u"杨仕航"
# modified: @kevinqqnj
import logging
import numpy as np
from queue import Queue, LifoQueue
import time
import copy
# DEBUG INFO WARNING ERROR CRITICAL
logging.basicConfig(level=logging.WARN,
format='%(asctime)s %(levelname)s %(message)s')
# format='%(as... | true |
c93277bff968a3ad0d5f66d03d54812ead49a4bf | Python | ajleeson/Self-Driving-Car-Simulation | /Algorithm/track.py | UTF-8 | 1,811 | 3.46875 | 3 | [] | no_license | class Track():
"""creates the tracks for all of the cars"""
# makes sure pixel resolution is high
def __init__(self, rows, cols, width, height, timeStep):
self.rows = rows # number of horizontal lanes
self.cols = cols # number of vertical lanes
self.width = width # pixels wides
... | true |
5a89d53a45a842faa0f9d05d78b2e45f98841e81 | Python | rizwan2000rm/interview-prep | /Python/DS/tuple.py | UTF-8 | 381 | 4.4375 | 4 | [
"MIT"
] | permissive | # Tuples are immutable
print("============ tuples ============")
print()
tuples = (12345, 54321, 'hello!')
print(tuples)
u = tuples, (1, 2, 3, 4, 5)
print(u)
# The statement t = 12345, 54321, 'hello!' is an example of tuple packing:
# the values 12345, 54321 and 'hello!'
# are packed together in a tuple. The revers... | true |
83b08e56b1c76fbe0d232cfd74b5e55a6ba091d2 | Python | CashFu/selenium3Fu | /seleium3/selenium_lfj/find_element.py | UTF-8 | 836 | 2.59375 | 3 | [] | no_license | #coding=utf-8
from util.read_ini import ReadIni
class FindElement():
def __init__(self,driver):
self.driver = driver
def get_element(self,key):
read_ini = ReadIni()
data_ini = read_ini.get_value(key)
by = data_ini.split('>')[0]
value = data_ini.split('>')[1]
... | true |
3291ec6e6d7d563367a61be37d23a743077a9ad7 | Python | poweihuang17/practice_leetcode_and_interview | /Leetcode/Greedy/757_Set_Intersection_Size_At_Least_Two.py | UTF-8 | 1,200 | 3.296875 | 3 | [] | no_license | class Solution(object):
def intersectionSizeTwo(self, intervals):
"""
:type intervals: List[List[int]]
:rtype: int
"""
intervals.sort()
filtered_intervals=[]
#print intervals
for interval in intervals:
while filtered_intervals and filtered_int... | true |
57c24a8a95e689732d67e4281cc5dbcb69a729d3 | Python | git208/AutoFrameRegressionTestF10 | /common/test_cases_select.py | UTF-8 | 3,230 | 2.703125 | 3 | [] | no_license | import json
import os
from common.yaml_RW import YamlRW
from config.logConfig import LogCustom,logging
from common.parse_excel import ParseExcel
def testCaseSelect(file,file_type='excel',
testcase_matching=None,
sheet_names=None,
isFuzzy=False,
... | true |
6b916309205853e112e1ce746da8af660b2ea869 | Python | francosbenitez/unsam | /04-listas-y-listas/01-debugger/debugger.py | UTF-8 | 1,073 | 4.28125 | 4 | [] | no_license | """
Ejercicio 4.1: Debugger
Ingresá y corré el siguiente código en tu IDE:
def invertir_lista(lista):
'''Recibe una lista L y la develve invertida.'''
invertida = []
i=len(lista)
while i > 0: # tomo el último elemento
i=i-1
invertida.append (lista.pop(i)) #
return invertida
l ... | true |
1493757adaaa0918e76b211c85051a989bd94c95 | Python | pdekeulenaer/sennai | /simulation.py | UTF-8 | 1,035 | 3.03125 | 3 | [] | no_license | import game, population
import random
# config parameters
# Population
n_cars = 10
start = (50,50)
# Brain
layers = 10
neurons = 20
# evolution
mutation_rate = 0.10
parents_to_keep = 0.33
# generate the brains
# brains = []
# for i in range(0, n_cars):
# seed = random.random()
# brains += [population.NeuronBr... | true |
59acb29b1e14e36b1c69230bfc320e122295e66f | Python | jeremyperthuis/UVSQ_BioInformatique | /td2/pgm8.py | UTF-8 | 241 | 3.609375 | 4 | [] | no_license | sq1 = raw_input("inserer une sequence ADN :")
i=0
n=len(sq1)-1
x=0
while i<n :
if sq1[i]==sq1[n] :
x=x+1
i=i+1
if x == (len(sq1)-1)/2 :
print "cette sequence est un palindrome"
else :
print"cette sequence n'est pas un palindrome"
| true |
1b276b69af3d8b7c304ffbfee9d891bb2a5fc6c7 | Python | wadimiusz/hseling-repo-diachrony-webvectors | /hseling_lib_diachrony_webvectors/hseling_lib_diachrony_webvectors/algos/global_anchors.py | UTF-8 | 2,582 | 3.140625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import gensim
import numpy as np
import copy
from tqdm.auto import tqdm
from utils import log, intersection_align_gensim
from gensim.matutils import unitvec
class GlobalAnchors(object):
def __init__(self, w2v1, w2v2, assume_vocabs_are_identical=False):
if not assume_vocabs_are_identical:
w2v1,... | true |
7bde88600f52f45f9e8b1f99707aa6a01e719b72 | Python | PAVANANUTHALAPATI/python- | /range.py | UTF-8 | 88 | 3.296875 | 3 | [] | no_license | pav=int(raw_input())
if pav in range (1,10):
print("yes")
else:
print("no")
| true |
97b0a68ee463f34a5ef2d2d429dad41b49121f51 | Python | GPUOpen-Drivers/llpc | /script/gc-amdvlk-docker-images.py | UTF-8 | 4,235 | 2.8125 | 3 | [
"MIT",
"Apache-2.0",
"NCSA"
] | permissive | #! /usr/bin/env python3
"""Script to garbage collect old amdvlk docker images created by the public CI on GitHub.
Requires python 3.8 or later.
"""
import argparse
import json
import logging
import subprocess
import sys
from collections import defaultdict
from typing import Any, Dict, List, Optional, Tuple
def _run... | true |
d710863243bb183e1be2960d5b8fc0b1602a7756 | Python | Dhirajpatel121/IPL-Predictive-Analytics | /IPL/MIvsCSK.py | UTF-8 | 7,233 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings; warnings.simplefilter('ignore')
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
deliveries = pd.read_csv('C:/Users/SONY/Desktop/IPL/deliveries... | true |
3541096c6c8edd5bcc12e74e32dadbffe14fcc02 | Python | helsinkithinkcompany/wide | /FennicaTrends/serious-spin-master/data/python/countRelativeWeights.py | UTF-8 | 1,828 | 2.890625 | 3 | [
"MIT"
] | permissive | import json, sys
from math import pow
# FILE HANDLING #
def writeJsonToFile(json_data, file_path):
try:
with open(file_path, 'w') as outfile:
json.dump(json_data, outfile)
return True
except Exception as e:
print(e)
print('Failed to dump json to file ' + file_path)
return False
def getJsonFromFile(fil... | true |
66f5a6d7bef3707c974e3210da2db94f6e393a4a | Python | schuCS50/CS33a | /finalproject/games/cards/models.py | UTF-8 | 4,162 | 2.703125 | 3 | [] | no_license | from django.contrib.auth.models import AbstractUser
from django.db import models
# Extended user class
class User(AbstractUser):
def __str__(self):
return f"User {self.id}: {self.username}"
# Two Player Game extendable
class TwoPlayerGame(models.Model):
player1 = models.ForeignKey(User,
... | true |
20ed11ef0f52d20c8f5abfc8c2e88cd5aa19a6d4 | Python | alaalial/relancer-artifact | /relancer-exp/original_notebooks/pavansubhasht_ibm-hr-analytics-attrition-dataset/imbalanceddata-predictivemodelling-by-ibm-dataset.py | UTF-8 | 19,857 | 3.390625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# # IBM HR Employee Attrition & Performance.
# ## [Please star/upvote in case you find it helpful.]
# In[ ]:
from IPython.display import Image
Image("../../../input/pavansubhasht_ibm-hr-analytics-attrition-dataset/imagesibm/image-logo.png")
# ## CONTENTS ::->
# [ **1 ) Expl... | true |
1b75c4e46d9e350474eef9c2c62b0a8be7811c3f | Python | CapAsdour/code-n-stitch | /Password_strength_Checker/output.py | UTF-8 | 384 | 3.5 | 4 | [
"MIT"
] | permissive | import re
v=input("Enter the password to check:")
if(len(v)>=8):
if(bool(re.match('((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*]).{8,30})',v))==True):
print("Good going Password is Strong.")
elif(bool(re.match('((\d*)([a-z]*)([A-Z]*)([!@#$%^&*]*).{8,30})',v))==True):
print("try Something strong... | true |
8c42b2cb1e91f49b57b8b67eda41cea9289907e8 | Python | wmm1996528/movie | /maoyan.py | UTF-8 | 3,578 | 2.734375 | 3 | [] | no_license | import requests
from pyquery import PyQuery as pq
import re
import time
import pymongo
from movie_douban import HotMovie
class mongdbs():
def __init__(self):
self.host = '127.0.0.1'
self.port = 27017
self.dbName = 'maoyan'
self.conn = pymongo.MongoClient(self.host, self.port)
... | true |
72bd060c16cf2e8034334c0643533764f52687d6 | Python | vvilq27/Python_port_OV7675 | /port/busCheck.py | UTF-8 | 1,977 | 2.625 | 3 | [] | no_license | import time
import serial
from serial import Serial
import os
import re
import numpy as np
from matplotlib import pyplot as plt
a = list()
t = []
pic = [ ['00' for i in range(320)] for j in range(240)]
s = serial.Serial('COM8', 2000000)
while b"\r\n" not in s.readline():
pass
c = 0
while True:
l = s.readline()... | true |
0c466cb695f150472a3e3494053fe474d629708b | Python | bluecube/heating | /db_net/registers.py | UTF-8 | 6,678 | 2.796875 | 3 | [] | no_license | import numpy
import re
import itertools
import struct
import db_net
def group(lst, n):
"""group([0,3,4,10,2,3], 2) => iterator
Group an iterable into an n-tuples iterable. Incomplete tuples
are discarded e.g.
>>> list(group(range(10), 3))
[(0, 1, 2), (3, 4, 5), (6, 7, 8)]
from http://code.ac... | true |
4857fe4164e37c4dd73b20c5d7278b92bac48458 | Python | SchoofsEbert/ASTinPython | /AST.py | UTF-8 | 586 | 2.921875 | 3 | [] | no_license | import ast
import astor
class AST:
def __init__(self, filename, transformer):
self.filename = filename
with open(filename, "r") as source:
self.AST = ast.parse(source.read())
self.transformer = transformer
def transform(self):
self.transformer.visit(self.AST)
... | true |
d1a665d626b2aa17707165e080d4fe699022d763 | Python | shlampley/learning | /learn python/fizz_buzz3.py | UTF-8 | 1,604 | 3.9375 | 4 | [] | no_license |
number = 0
variables = ""
def fizz_buzz(num, var):
fizzarray = []
# doneTODO: Create an empty array outside the loop to store data
var = variables
num = number
while num < 100:
# Reset var to prevent issues of adding buzz to buzz or buzz to fizzbuz
var = ""
#print(num)
... | true |
736d96574422b7b00e7b8756628dcf418e473476 | Python | inhyuck222/python-ch2.4 | /for.py | UTF-8 | 990 | 4.375 | 4 | [] | no_license | # 반복문
a = ['cat', 'cow', 'tiger']
for animal in a:
print(animal, end=' ')
else:
print('')
# 복합 자료형을 사용하는 for문
l = [('루피', 10), ('상디', 20), ('조로', 30)]
for data in l:
print('이름: %s, 나이: %d' % data)
for name, age in l:
print('이름: {0}, 나이: {1}'.format(name, age))
l = [{'name': '루피', 'age': 30}, {'name'... | true |
f66dd9735cfdcffa7c2070e219d517ff72496676 | Python | queenie0708/Appium-Python | /alipay.py | UTF-8 | 1,075 | 2.59375 | 3 | [] | no_license | from appium import webdriver
import threading
from appium.webdriver.common.touch_action import TouchAction
from time import sleep
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '9'
desired_caps['deviceName'] = 'PDP'
desired_caps['appPackage'] = 'com.eg.android.AlipayGphone... | true |
99636db6bcf420043a9a2c894ebfd7f9fbbb8042 | Python | YOODS/rovi_utils | /mesh_aid/samples/degraded.py | UTF-8 | 1,987 | 3.265625 | 3 | [] | no_license | import open3d as o3d
import numpy as np
def degraded_copy_point_cloud(cloud, normal_radius, n_newpc):
"""
与えられた点群データからPoisson表面を再構成し、頂点データからランダムに点を取り出して
新たな点群を作成する.
Parameters
----------
cloud : open3d.geometry.PointCloud
入力点群
normal_radius : float
法線ベクトル計算時の近傍半径(Poisson表面... | true |
94946ebf1eada337cbf53b95fa700d32e8c8d9a6 | Python | HesterXu/Home | /Public/api/api_03_天气接口.py | UTF-8 | 437 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/12/3/16:15
# @Author : Hester Xu
# Email : xuruizhu@yeah.net
# @File : api_03_天气接口.py
# @Software : PyCharm
import requests
weather_url_1 = 'http://t.weather.sojson.com/api/weather/city/101030100'
weather_res_1 = requests.get(weather_url_1)
print(weather_res_1)
pr... | true |
e3e53969c31c9d312829564901ad8861c6e11f72 | Python | yhshu/OpenKE-Embedding-Service | /freebase_embedding_server.py | UTF-8 | 6,993 | 2.578125 | 3 | [] | no_license | import numpy as np
import datetime
from flask import Flask, request, jsonify, json
class FreebaseEmbeddingServer:
dir_path: str
entity_to_id: dict # entity mid -> entity id
relation_to_id: dict
entity_vec: np.memmap
relation_vec: np.memmap
dim: int # embedding dimension for each entity or re... | true |
50dcf5643d28de1a3059967341b2a596ed7b40fa | Python | rohanaggarwal7997/Studies | /Python new/inheritance.py | UTF-8 | 318 | 3.578125 | 4 | [] | no_license | class Parent:
def printlastname(self):
print('Aggarwal')
class Child(Parent): #inherited Parent class
def print_name(self):
print('Rohan')
def printlastname(self): #overwriting parent function
print('Aggar')
bucky=Child()
bucky.print_name()
bucky.printlastname() | true |
0a60ed50abd1dcb8af906bf377beeed159d4e47f | Python | thautwarm/gkdtex | /gkdtex/wrap.py | UTF-8 | 859 | 2.5625 | 3 | [
"MIT"
] | permissive | import warnings
warnings.filterwarnings('ignore', category=SyntaxWarning, message='"is" with a literal')
from gkdtex.parse import *
from gkdtex.lex import *
_parse = mk_parser()
def parse(text: str, filename: str = "unknown"):
tokens = lexer(filename, text)
status, res_or_err = _parse(None, Tokens(tokens))
... | true |
13c7664efff8eb0ab25d6dd0f8e73e276b631438 | Python | andreiqv/rotate_network | /make_data_dump.py | UTF-8 | 3,182 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import os.path
import sys
from PIL import Image, ImageDraw
import _pickle as pickle
import gzip
import random
import numpy as np
np.set_printoptions(precision=4, suppress=True)
def load_data(in_dir, shape=(540,540,1)):
img_size = shape[0], shape[1]
data = d... | true |
9594b96038df1f0d2c02de4bbf9ca543ed97ab5c | Python | MiguelAbadia/TIC-Abad-a | /Programms Python/ejercicio8.py | UTF-8 | 198 | 3.40625 | 3 | [] | no_license | def ejercicio8():
n=input("Dime un numero entero positivo")
if n>0:
print "Los cuadrados son",n,n*n,n*n*n,n*n*n*n
else:
print "Eso es negativo"
ejercicio8()
| true |
ad3b213de470c3a58659c325ac83fb9671b5ebf8 | Python | segimanzanares/acs-djangoapi | /src/shows/serializers.py | UTF-8 | 1,764 | 2.546875 | 3 | [] | no_license | from rest_framework import serializers
from shows.models import Show, Episode
from django.utils import timezone
import os
class EpisodeSerializer(serializers.ModelSerializer):
class Meta:
model = Episode
fields = ('id', 'show', 'title', 'description', 'cover')
def create(self, validated_data):... | true |
2792d988960038d69fa8cf4df7c84be7733a9751 | Python | TangleSpace/swole | /swole/core/application.py | UTF-8 | 3,849 | 2.78125 | 3 | [] | no_license | import os
import enum
from typing import Dict
from fastapi import FastAPI
from starlette.responses import FileResponse
import uvicorn
from swole.core.page import Page, HOME_ROUTE
from swole.core.utils import route_to_filename
from swole.widgets import Widget
SWOLE_CACHE = "~/.cache/swole" #: Default directory ... | true |
6adaa62ac1986dcd4d811aeec82cad429178a601 | Python | chen19901225/SimplePyCode | /SimpleCode/PY_CookBook/chapter11/1_http_simple_get.py | UTF-8 | 189 | 2.6875 | 3 | [] | no_license |
import urllib
url='http://www.baidu.com'
params=dict(name1='value1',name2='value2')
querystring=urllib.urlencode(params)
u=urllib.urlopen(url+'?'+querystring)
resp=u.read()
print resp
| true |
02087c6ead589bf24ddcbcd6f0309fa0df9bf0cd | Python | andoniabedul/cmd-cryptocurrency-watcher | /services/Ticket.py | UTF-8 | 2,456 | 2.703125 | 3 | [
"MIT"
] | permissive | import json
#from helpers.format_response import exchanges as format_response
from helpers.messages import messages as messages
from api.call import exchanges as api_call
class Ticket:
def __init__(self, base_pair, pair):
self.base_pair = base_pair
self.pair = pair
self.exchanges = ['coinbase', 'bitfinex... | true |
e3c5999afa33a13d1a3271b55e648f365694c35e | Python | luckydimdim/grokking | /in_place_reversal_of_a_linked_list/reverse_every_k_element_sub_list/main.py | UTF-8 | 3,388 | 4.125 | 4 | [] | no_license | from __future__ import print_function
class Node:
def __init__(self, value, next=None):
self.value = value
self.next = next
def print_list(self):
temp = self
while temp is not None:
print(temp.value, end=" ")
temp = temp.next
print()
def reverse_every_k_elements2(head, k):
'''... | true |
252753f358e2106a377fe0abd8311512c351cc0d | Python | znorm/Euler | /006.py | UTF-8 | 221 | 3.796875 | 4 | [] | no_license | sumofsquares = 0
squareofsum = 0
for x in range(1,101):
sumofsquares = sumofsquares + (x**2)
squareofsum = squareofsum + x
squareofsum = squareofsum ** 2
print( squareofsum - sumofsquares)
#269147
| true |
28ea5a719de789bf35197e427659db6fbe96093a | Python | AndersonHJB/PyCharm_Coder | /Coder_Old/pycharm_daima/爬虫大师班/插件合集/参数转换/headers_app.py | UTF-8 | 468 | 3.203125 | 3 | [] | no_license | import re
def headers_to_dict(data):
global headers
for value in data:
try:
hea_data = re.findall(r'(.*?): (.*?)\n', value)[0]
headers.setdefault(hea_data[0], hea_data[1])
except IndexError:
hea_data = value.split(': ', 1)
headers.setdef... | true |
9d03c8b7f3b90341d68c9b4d8e4a99f9863befb9 | Python | Eric-cv/QF_Python | /day2/input_demo.py | UTF-8 | 638 | 4.125 | 4 | [] | no_license | # 输入:input()
#name = input()
#print(name)
#name = input('请输入你的名字:') #阻塞式
#print(name)
'''
练习:
游戏:捕鱼达人
输入参与游戏者用户名
输入密码:
充值: 500
'''
print('''
*********************
捕鱼达人
*********************
''')
username = input('请输入参与游戏者的用户名:\n')
password = input('输入密码:\n')
print('%s请充值才能进入游戏\n' %username)
coins =... | true |
d41df6088fd195dc8263760aeef440c05b77b30a | Python | AngieGD/MCTS_Juego_uno | /TicTacToe/juegoAlternativa.py | UTF-8 | 3,936 | 3.5625 | 4 | [] | no_license |
import numpy as np
import pandas as pd
from os import system
class Table():
def __init__(self):
self.table = [[' ',' ',' '],
[' ',' ',' '],
[' ',' ',' ']]
def getMoves(self):
moves = []
for x in range(3):
for y in range(3):
... | true |
52de409311d4836172986571fec8825b316f644d | Python | mithem/serverly | /test_utils.py | UTF-8 | 6,154 | 3 | 3 | [
"MIT"
] | permissive | import pytest
import serverly.utils
from serverly.utils import *
def test_parse_role_hierarchy():
e1 = {
"normal": "normal",
"admin": "normal"
}
e2 = {
"normal": "normal",
"admin": "normal",
"staff": "admin",
"root": "staff",
"god": "staff",
}
... | true |
e3c75609405865a1b44c1a4c295c56e6027268a9 | Python | coy0725/leetcode | /python/405_Convert_a_Number_to_Hexadecimal.py | UTF-8 | 848 | 3.03125 | 3 | [
"MIT"
] | permissive |
class Solution(object):
def toHex(self, num):
"""
:type num: int
:rtype: str
"""
if num == 0:
return '0'
# letter map
mp = '0123456789abcdef'
ans = ''
for _ in range(8):
# get last 4 digits
# num & 1111b
... | true |
0c1c2070bd92dca3273bc5db8f336d924f16755a | Python | lollyxsrinand/ChristmasGame | /main.py | UTF-8 | 3,190 | 3.4375 | 3 | [] | no_license | import math
from random import randint
import pygame as pg
from pygame import mixer as mx
""" INITIALISING PYGAME """
pg.init()
""" CREAITNG SCREEN """
screen = pg.display.set_mode((800, 600))
""" BACKGROUND MUSIC """
# mx.music.load('lofi_background.wav')
# mx.music.set_volume(0.8)
# mx.music.play(-1)... | true |
57d5f1d8de021f5a9aee01fb1af5d80bb2bf811d | Python | ddannenb/sentence-transformers | /examples/training_quora_duplicate_questions/application_Information_Retrieval.py | UTF-8 | 3,060 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | """
This is an interactive demonstration for information retrieval. We will encode a large corpus with 500k+ questions.
This is done once and the result is stored on disc.
Then, we can enter new questions. The new question is encoded and we perform a brute force cosine similarity search
and retrieve the top 5 question... | true |
f07a84f01826b5b7d196bcedeaf3f7cfc1802d30 | Python | WolfireGames/overgrowth | /Libraries/freetype-2.12.1/builds/meson/extract_freetype_version.py | UTF-8 | 2,997 | 3 | 3 | [
"FTL",
"GPL-1.0-or-later",
"BSD-3-Clause",
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain",
"GPL-3.0-only",
"LicenseRef-scancode-unknown",
"Zlib",
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | permissive | #!/usr/bin/env python3
#
# Copyright (C) 2020-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this fil... | true |
b5043ccef979bc25c293b102dbcd993d3c1b5ef5 | Python | Maxpa1n/modules_pytorch | /models/MAML-wave/learnmodel.py | UTF-8 | 1,275 | 2.796875 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.nn import functional as F
class Compute(nn.Module):
def __init__(self, hid_dim):
super(Compute, self).__init__()
self.input_layer = nn.Linear(1, hid_dim)
# self.hid_layer = nn.Linear(hid_dim, hid_dim)
self.output_layer = nn.Linear(hi... | true |
8e779cf6391028a37be8cb20c5b01c587ab0362c | Python | MohammadAsif206/BankAPI-Pzero | /ProjectZero/services/account_service.py | UTF-8 | 1,366 | 2.765625 | 3 | [] | no_license |
from abc import ABC, abstractmethod
from entities.account import Account
class AccountService(ABC):
# General CRUD functionality
@abstractmethod
def create_account_by_customer_id(self, account: Account, customer_id: int):
pass
@abstractmethod
def retrieve_all_accounts_by_cid(self, custome... | true |
8def9170ec61069e564024dd50482b1f999e365d | Python | rosechellejoy/cmsc128-ay2015-16-assign001-py | /oraa_pa.py | UTF-8 | 7,813 | 3.484375 | 3 | [] | no_license | """
Rosechelle Joy C. Oraa
2013-11066
CMSC 128 AB-3L
"""
import sys
"""
numToWords() accepts an input number and outputs its equivalent in words
temp_num : input by the user
"""
def numToWords(temp_num):
if len(temp_num)>7: #if number inputed is greater than 7 digits: invalid
print 'Invalid: input can o... | true |
499c8883c63e328da19afada8b240fd244c777d8 | Python | tushargupta14/compositional_semantics | /create_fastText_dict2.py | UTF-8 | 2,091 | 2.78125 | 3 | [] | no_license | import json
from collections import defaultdict
def create_dictionaries(path_to_files):
print "Creating Dictionaries"
count = 0
source_fastText_dict = defaultdict(list)
with open(path_to_files+"source_fastText_output.txt","r") as source_file:
for line in source_file :... | true |
a819b7c9b02372e48784b4ddced181e7c151cb7b | Python | jack-mcivor/afl-predictor | /afl/models.py | UTF-8 | 4,931 | 3.0625 | 3 | [] | no_license | from collections import defaultdict
from math import exp, log
import pandas as pd # optional
class Elo:
"""Base class to generate elo ratings
Includes the ability for some improvements over the original methodology:
* k decay: use a higher update speed early in the season
* crunch/carryover... | true |
48f064838cbf993b4e54813f86f3344080368bf9 | Python | noahwang07/python_start | /fresher_class.py | UTF-8 | 419 | 3.734375 | 4 | [] | no_license | class Human(object):
def __init__(self, name):
self.name = name
def walk(self):
print (self.name + " is walking")
def get_name(self):
return (self. name)
def set_name(self, name):
if len(name) <= 10:
self.name = name
human_a = Human("alan")
print (human_a.name)
human_a.set_name('bob')
prin... | true |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 447