max_stars_repo_path null | max_stars_repo_name null | max_stars_count null | id null | text string | score float64 | int_score int64 | from string | blob_id string | repo_name string | path string | length_bytes int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|
null | null | null | null | import helpers
def isPrime(numberToCheck):
# for every number between the given number and 2, make sure it does NOT divide evenly
for divisor in range(2, numberToCheck):
if (numberToCheck % divisor == 0):
return False
return True
def findPrimeFactors(numberToCheck):
if (isPrime... | 4.09375 | 4 | smollm | 5bc6177ec3bdacbb71247316bfe9b75d0af4d86d | gmeluski/Projects | /Numbers/prime_factors.py | 882 |
null | null | null | null | """
Count Vowels - Enter a string and the program counts
the number of vowels in the text. For added complexity
have it report a sum of each vowel found.
"""
string = raw_input('Enter a string: ').lower()
vowels = ['a', 'e', 'i', 'o', 'u']
counts = dict(zip(vowels, [0, 0, 0, 0, 0]))
for vowel in counts:
for char... | 4.21875 | 4 | smollm | 154ed3baebe70637959e82b655570965ad12c9f7 | gmeluski/Projects | /Text/count_vowels.py | 403 |
null | null | null | null | #Escribir un programa pida al usuario dos numeros enteros e informe por pantalla cual
#es menor de los dos, si son iguales, indicarlo por separado.
ingreso1= int(input("ingrese el primer número: "))
ingreso2= int(input("ingrese el segundo número: "))
if(ingreso1>ingreso2):
print('El número menor es el segundo ingr... | 4.21875 | 4 | smollm | 8cdba06ad22d465aa3ad8c9155954a0bf40d8af2 | marianraven/estructuraPython | /ejercicio6.py | 477 |
null | null | null | null | #Escribir un programa que recibe como entrada desde el usuario dos números enteros
#e informa por pantalla todos los números pares entre ellos.
ingreso1= int(input('ingrese el número 1:'))
ingreso2= int(input('ingrese el número 2:'))
if(ingreso1<ingreso2):
while ingreso1 < ingreso2:
ingreso2-=1
if(ingre... | 4.0625 | 4 | smollm | dbe3504efa1ec7a44c2ca8d212f786af1d475001 | marianraven/estructuraPython | /ejercicio19.py | 485 |
null | null | null | null | import tkinter as tk
from tkinter import *
win=tk.Tk()
win.geometry("600x900")
Name=tk.Label(win,text="Name").place(x=30,y=50)
Address=tk.Label(win,text="Address").place(x=30,y=90)
Email=tk.Label(win,text="Email").place(x=30,y=130)
Schoolname=tk.Label(win,text="Schoolname").place(x=30,y=170)
Stding_in_year=... | 3.625 | 4 | smollm | 5146b61e52e4eefc928070a4bc72026b3c05e387 | ShrutiBalla9/ShrutiBalla7 | /GUI2.py | 1,382 |
null | null | null | null | a=float(input("Enter your age"))
b=float(input("Enter your age"))
c=float(input("Enter your age"))
if a>b : print("age of shruti is ",a)
elif b>c : print(b)
else : print(c) | 3.859375 | 4 | smollm | 77aa4895ea201c2e54319ec572c1c954a11861c2 | ShrutiBalla9/ShrutiBalla7 | /age.py | 178 |
null | null | null | null | X = 'X'
O = 'O'
EMPTY = ' '
TIE = 'TIE'
NUM_SQUARES = 9
def display_instruct():
print(
"""
Moves will be made by entering a number, 0 - 8.
The number corresponds to the board position as
illustrated:
0 | 1 | 2
----------
3 | 4 | 5
----------
6 | 7 | 8
\n
"""
)
def... | 4.0625 | 4 | smollm | e8148749804a95c98cfcfed750069acb9e45ec16 | jrob38/Tic-Tac-Toe-master | /TicTacToe/game.py | 4,835 |
null | null | null | null | class Circulo:
# variable de clase
pi = 3.1416
# metodo
def __init__(self, radio):
self.radio = radio
self.perimetro = 4
def suma(self):
return "suma"
circulo1 = Circulo(1)
circulo2 = Circulo(2)
# obtiene valor de variable de clase sin instanciar
print(Circulo.pi)
# obti... | 3.515625 | 4 | smollm | d478e2251607fe8bd655689c55cd9822353731c2 | jbascunan/Python | /1.Introduccion/14.variables_de_clase.py | 389 |
null | null | null | null | class TinyIntError(Exception):
pass
def tyni_int(val):
return val >= 0 and val <= 255
try:
numero = 400
if tyni_int(numero):
print("el numero es correcto")
else:
raise TinyIntError(
"este es un mensaje para los numeros que no son tyni_int")
except TinyIntError as erro... | 3.609375 | 4 | smollm | 767d87e12859c198637bbb5567e053bfb7e35948 | jbascunan/Python | /1.Introduccion/24.raise.py | 340 |
null | null | null | null | import turtle
def draw_square():
window = turtle.Screen()
window.bgcolor("grey")
stephane = turtle.Turtle()
turn_times = 4
turn_count = 0
stephane.shape("turtle")
shape_colors = ["blue", "green", "yellow", "black"]
while (turn_count < turn_times):
stephane.color(shape_col... | 3.78125 | 4 | smollm | 15bd989a29023a91e8ce479d5e1ae31b21fccf34 | slopesneves/draw_square | /square_draw.py | 471 |
null | null | null | null | cases = input()
for x in range(cases):
case = raw_input().split()
case[0] = int(case[0])
case[1] = int(case[1])
word_list = []
for x in range(case[0]):
add = True
save = [1, raw_input()]
for y in range(len(word_list)):
if save[1] == word_list[y][1]:
word_list[y][0] = word_list[... | 4.0625 | 4 | smollm | e5cc3a91ada987f519c9db742aeadf45e7c9b6af | bobyaaa/Competitive-Programming | /Other/CCO '99 - Common Words.py | 3,556 |
null | null | null | null | #Input
graph1 = {'A': [],
'B': [],
'C': [],
'D': [],
'E': [],
'F': [],
'G': [],
'H': [],
'I': [],
'J': [],
'K': [],
'M': [],
'O': [],
'P': [],
'Q': [],
'R': [],
'S': [],
... | 3.59375 | 4 | smollm | db9cad0c0a2629b146e5feb017dec94e94f142e0 | bobyaaa/Competitive-Programming | /CCC/CCC '01 S3 Strategic Bombing.py | 1,537 |
null | null | null | null | n = input()
li1 = []
for x in range(n):
li1.append(input())
m = input()
li2 = []
for x in range(m):
li2.append(input())
total = sum(li1)
for x in range(len(li2)):
total = total + li2[x]
average = (total / (float(len(li1) + (x + 1))))
print format(average, '.3f')
| 3.890625 | 4 | smollm | e1cb93391a43162866536ead6ad655372507a3da | bobyaaa/Competitive-Programming | /Other/DMOPC '14 Contest 1 P3 - New Students.py | 278 |
null | null | null | null | #https://www.quora.com/Given-a-string-how-do-I-find-the-number-of-distinct-substrings-of-the-string
#This guy gives a beautiful explanation ^^^
#Code by Andrew Xing
def longest_common_prefix(suffix1, suffix2):
LCP = 0
if len(suffix1) > len(suffix2):
if suffix1.index(suffix2[0]) == 0:
for x in... | 4.03125 | 4 | smollm | e357f2b8ec7b74315ecaba91b65f73c071f6b8a0 | bobyaaa/Competitive-Programming | /CCC/CCC '03 S4 Substrings.py | 987 |
null | null | null | null | age1 = input()
age2 = input()
if age2 >= age1:
print (age2 - age1) + age2
else:
print (age1 - age2) + age1
| 3.625 | 4 | smollm | 54703fa3b765233c283eabd8c2bbdc38a677ab22 | bobyaaa/Competitive-Programming | /CCC/CCC '13 J1 Next in line.py | 116 |
null | null | null | null | #import random
#fruits = ['apple', 'banana', 'guava']
#fruit = random.choice(fruits)
#print(fruit)
#for i in range (100):
import random
eyes = [':', '8', 'x', ';']
noses = ['-', '~', 'っ', '^', '\'', '']
mouths = ['D', 'O', 'o', ')', '(', '<', 'v', 'P']
for i in range(5): #for loop generates 5
eye = random.choi... | 3.8125 | 4 | smollm | f1c3d6fa62080488273841e3e1fa18e07a1ecc57 | EddieMichael1983/PDX_Code_Guild_Labs | /demo1.py | 1,074 |
null | null | null | null | #rot13.py
#Modulus is going to help you!
message = input("Type your message here: ")
#def rot13(message):
for character in message: #iterates
#ASCII character code
ascii_representation = ord(character) #step 1: convert to ASCII
print(ord(character))
for character in message:
ascii_plus_13... | 4.15625 | 4 | smollm | c8b55a4597b569b53cff693f5c42eade8d3ede87 | EddieMichael1983/PDX_Code_Guild_Labs | /rot13.py | 541 |
null | null | null | null | nums = [] #sets up list of numbers
while True: #user enters values until done
value = input('Enter a number, or done: ')
if value == 'done':
break
nums.append(float(value)) #users entries to list each time
#use float instead of int to account for decimal po... | 4.25 | 4 | smollm | 149c6701f818dd612dcc64f594898ffe9a8f4a9b | EddieMichael1983/PDX_Code_Guild_Labs | /avg_nums_v2.py | 801 |
null | null | null | null | #number_to_phrase.py
ones = { 1 : 'one', 2 : 'two', 3 : 'three', 4 : 'four', 5 : 'five', 6 : 'six', 7 : 'seven', 8 : 'eight', 9 : 'nine'}
teens = { 10 : 'ten', 11 : 'eleven', 12 : 'twelve', 13 : 'thirteen', 14 : 'fourteen', 15 : 'fifteen', 16 : 'sixteen', 17 : 'seventeen', 18 : 'eighteen', 19 : 'nineteen'}
tens = { 2... | 3.78125 | 4 | smollm | 6584a4e2089ecefe33a55295272a98f705b2f751 | EddieMichael1983/PDX_Code_Guild_Labs | /number_to_phrase.py | 848 |
null | null | null | null |
def bfsCall(graph, start):
queue = [start]
seen = set()
seen.add(start)
while len(queue) > 0:
vertex = queue.pop(0)
nodes = graph[vertex]
for w in nodes:
if w not in seen:
queue.append(w)
seen.add(w)
print(vertex)
| 3.5625 | 4 | smollm | 234dcc36f4e7b3f2ad315d859798d6a3756b4039 | ManchuChris/MongoPython | /bfs/bfs.py | 309 |
null | null | null | null | # You have a map that marks the location of a treasure island. Some of the map area has jagged rocks and dangerous reefs. Other areas are safe to sail in.
# There are other explorers trying to find the treasure. So you must figure out a shortest route to the treasure island.
#
# Assume the map area is a two dimensional... | 4 | 4 | smollm | 11a3c38efaad5f207e7599539e1582733e8f6982 | ManchuChris/MongoPython | /TreasureIsland/treasureIsland.py | 1,790 |
null | null | null | null | # -*- coding: utf-8 -*-
import sys
sys.path.insert(0, "../Expression")
from Graph import Graph
from collections import deque
class BipartitionDetection():
def __init__(self, g):
self._g = g
self._visited = [False] * g.v()
self._colors = [0] * g.v()
self._isBipar... | 3.53125 | 4 | smollm | 10c04155cfe1694964306ecbf669ecc241fabcc3 | l8g/graph | /Graph/Bfs/BipartitionDetection.py | 1,466 |
null | null | null | null | #Question 1: Create a function to calculate the area of a circle by taking radius from user.
x = float(input("Enter radius of circle : "))
def area(x): #Defining the function
a = 3.14*x*x
print("Area of circle is : ")
print(a)
area(x) #Calling of fu... | 4.09375 | 4 | smollm | 0944ae71d8a604e00a08d58835ffd50c21bc1322 | nidhidhiman/restaurant_management | /function.py | 1,607 |
null | null | null | null | import numpy as np
import pandas as pd
import streamlit as st
# Define a function 'app()' which accepts 'census_df' as an input.
def app(census_df):
# View Dataset Configuration
# Add an expander and display the dataset as a static table within the expander.
st.subheader("View Data")
with st.beta_expander("Vie... | 3.828125 | 4 | smollm | 855bc3441d75d8b53608c4a6b8d08a854e56ea16 | rishab2404/census_df | /census_home.py | 1,380 |
null | null | null | null | def ways(A, n , X):
if X == 0:
return 1
if X < 0:
return 0
if n<= 0 and X >= 1:
return 0
return ways(A, n - 1, X) + ways(A, n, X - A[n-1])
def dynamix_ways(X):
table = [0] * (X + 1)
table[0] = 1
for i in range(1, len(table)):
table[i] += table[i - 1]
fo... | 3.53125 | 4 | smollm | c4abe42b1034b38bed06aa16791c4065f75e1e6b | rashed091/Algorithm-and-Data-structures | /DynamicProgramming/ways-to-reach-number-using-1-2.py | 490 |
null | null | null | null | greeting = "Hello world! "
greeting[4]
print('world' in greeting)
len(greeting)
print(greeting.find('lo'))
print(greeting.replace('llo', 'y'))
print(greeting.startswith('Hell'))
print(greeting.isalpha())
greeting.lower() # => "hello world! "
greeting.title() # => "Hello World! "
greeting.upper() # => "HELLO WORLD! "... | 4 | 4 | smollm | 5632aa125e8c889e54e253d78f37acbf2d9c26f9 | rashed091/Algorithm-and-Data-structures | /Basic/string_problems.py | 580 |
null | null | null | null | def is_balanced(parentheses):
stack = []
for paren in parentheses:
if paren == '(':
stack.append(paren)
else:
try:
stack.pop()
except IndexError:
return False
return len(stack) == 0
print(is_balanced('(()'))
| 3.890625 | 4 | smollm | 6c9e1356fbad8c135ea711b1c913758890cdd18d | rashed091/Algorithm-and-Data-structures | /Stack/balanced.py | 306 |
null | null | null | null | from itertools import *
import operator
counter = count()
print(list(next(counter) for _ in range(5)))
print(list(accumulate([1, 2, 3, 4, 5], operator.add)))
def first_order(p, q, initial_val):
"""Return sequence defined by s(n) = p * s(n-1) + q."""
return accumulate(repeat(initial_val), lambda s, _: p*s + ... | 3.71875 | 4 | smollm | 7caa7b9a64205b8956f80db172341de5a00d9ed5 | rashed091/Algorithm-and-Data-structures | /Basic/sequence_module.py | 1,168 |
null | null | null | null | import numpy as np
import matplotlib.pyplot as plt
"""this week we created graphs, learnt about polyfit which automatically gives a value of m and c in y = mx + c"""
# create a graph, -2 <= x < 2, against x, x^2 and x^3
x = np.linspace(-2, 2, 100)
g = x ** 2
h = x ** 3
plt.plot(x, x)
plt.plot(x, g)
plt... | 4.15625 | 4 | smollm | fc1611a586a58966163aaecb1f22e250f4e15b58 | olivercook197/ScientificComputationWithPython | /week1_handout.py | 1,434 |
null | null | null | null | """
else 在 for;try; while 正常结束的时候执行。
先来看一个没有应用else子句的例子:
"""
def print_prime(n):
""" 获得质数 """
for i in range(2, n):
found = True
for j in range(2, i):
if i % j == 0:
break
if found:
print(i, " is a prime number ")
print_prime(100)
"""
如果对else... | 4.03125 | 4 | smollm | 224b7d6507489d023d8c7cc38cf23348671bf39d | MrLawes/quality_python | /23_使用else子句简化循环(异常处理).py | 1,538 |
null | null | null | null | #coding:utf-8
import json
#dict转换成json字符串
d=dict(name="Bob",age=20,score=100)
j=json.dumps(d)
print(j)
#json字符串转换成dict
j='{"name":"Bob","age":20,"score":100}'
d=json.loads(j)
print(d)
class Student(object):
def __init__(self,name,age,score):
self.name=name
self.age=age
self.score=score
def student_dict(std... | 3.875 | 4 | smollm | 706465d7c1e7a6eb9bf87d8396ab02c15e2491b2 | amxsa/python_demo | /pythonAPI/29.json.py | 593 |
null | null | null | null | # string
"""---> colection of characters is called string
----->group of charactres is called string
----->in python string representation is ' 'or " "or " " "
----->in python strings are immutable
------>in python string is indexed value based
------>string supports slicing operator(':')
"""
a=" "
#print(type(a))
#... | 4.3125 | 4 | smollm | 805dcb95fbe0779a9e93f93d72478f7211ce976a | tejaswinikommu-14/pythonteju | /string.py | 1,527 |
null | null | null | null |
def main():
r=int(input())
c=int(input())
m=r*c
Lista1=[]
Lista2=[]
index=0
if r==c:
for i in range (m):
n=int(input())
Lista1.append(n)
while index <m:
Elemento=Lista1[index]
Lista2.append(Elemento)
index=index+(r+... | 3.75 | 4 | smollm | a6990ce6000774a9868d3136a4d7710ad2bfad34 | C-SON-TC1028-001-2113/listas---quiz-5-A01252396 | /assignments/16DiagonalPrincipal/src/exercise.py | 446 |
null | null | null | null | # Вывести на экран коды и символы таблицы ASCII,
# начиная с символа под номером 32 и заканчивая 127-м включительно.
# Вывод выполнить в табличной форме: по десять пар "код-символ" в каждой строке.
i = 0
a = 32
while i < 9:
print("---------------------------------------------------")
s = ""
j = 0
while ... | 4.125 | 4 | smollm | b015fa10510dd279d5629c3f71da2bf000b48059 | kesch9/Alg_Data_Structur_Python_Homework | /lesson_2/task5.py | 743 |
null | null | null | null | # В программе генерируется случайное целое число от 0 до 100.
# # Пользователь должен его отгадать не более чем за 10 попыток.
# # После каждой неудачной попытки должно сообщаться больше или
# # меньше введенное пользователем число, чем то, что загадано.
# # Если за 10 попыток число не отгадано, то вывести загаданное ч... | 3.953125 | 4 | smollm | c193990e73e47505454a8a9292ad72e14f047088 | kesch9/Alg_Data_Structur_Python_Homework | /lesson_2/task6.py | 983 |
null | null | null | null | # В массиве случайных целых чисел поменять местами минимальный и максимальный элементы.
import sys
def changeMaxMin(x):
max = 0
indexMax = 0
min = sys.maxsize
indexMin = 0
if (type(x) == list):
index = 0
for i in x:
if max < i:
max = i
ind... | 4.1875 | 4 | smollm | 9712bcd4aaacb79aadc6892cfa267d4c6218b9da | kesch9/Alg_Data_Structur_Python_Homework | /lesson_3/task3.py | 652 |
null | null | null | null | # Определить, какое число в массиве встречается чаще всего.
def maxIn(x):
y = dict()
if (type(x) == list):
a = set(x)
for i in a:
z = 1
for j in x:
if i == j:
y[i] = z
z += 1
return y
return {}
x = [1,3,... | 4 | 4 | smollm | 73217529d4a82e6262389d23cd57a9a2e6963bbe | kesch9/Alg_Data_Structur_Python_Homework | /lesson_3/task4.py | 400 |
null | null | null | null | from turtle import Turtle, Screen
import random
tim = Turtle()
screen = Screen()
tim.pensize(2)
tim.speed(10)
screen.colormode(255)
screen.title("Spirograph")
tim.hideturtle()
def random_colour():
red = random.randint(0, 255)
green = random.randint(0, 255)
blue = random.randint(0, 255)
... | 3.859375 | 4 | smollm | 5a9bdd7fadb254db17dca0f9c0d1a1f0e102614c | Chandananitg/Spirograph | /main.py | 1,328 |
null | null | null | null | #嵌套函式 3
#多重相乘
def multi(n):
if n == 0:
return None
#def multi(x):
# return n * x
multi = lambda x: n * x
return multi #得到第 8 行的方法參考
if __name__ == "__main__":
n3 = multi(3)
n5 = multi(5)
print(n3(6)) # x = 6
print(n5(n3(6))) # n5(n3(6)) -> n3(18) -> 90 | 4.28125 | 4 | smollm | 74fd67e7f79d63f93726d6d28cf1997bc180def5 | a26703248/Arduino4Py_2021 | /case02/EnclosingDef3.py | 339 |
null | null | null | null | def make_store_string(self):
self.binary_string = []
string_tree = str(self.binary_tree)
for element in self.all_letters:
index_of_letter = string_tree.index(element)
print(index_of_letter)
right_pointer = index_of_letter
left_pointer = index_of_letter
while left_poin... | 3.796875 | 4 | smollm | b08c6866aff88ea3b4997885a3e602c3a5775ef7 | Hitthesurf/PythonFun | /Huffmen_Compression/discarded_code.py | 1,569 |
null | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 4 17:33:26 2020
@author: pi
"""
from unittest import TestCase
from GameOfLife import GameOfLifeGrid
class TestGameOfLifeGridCount(TestCase):
def before_each_test(self):
grid = GameOfLifeGrid()
#grid.grid_size = [6,6]
i... | 3.828125 | 4 | smollm | 745b178f39ab2c01c675bd3b1bf9f802cffe1208 | Hitthesurf/PythonFun | /GameOfLife/test_GameOfLife.py | 5,753 |
null | null | null | null | import RPi.GPIO as GPIO
# define led and button pins
LED_PIN = 11
BUTTON_PIN = 12
print ('Program is starting...')
# set Numbers GPIOs by physical location
GPIO.setmode(GPIO.BOARD)
# set led pin's mode is output
GPIO.setup(LED_PIN, GPIO.OUT)
# Set button pin's mode is input, and pull up to high level(3.3V)
G... | 3.8125 | 4 | smollm | cc4c02cbcda447f10dbd074c781359ad563eac98 | orlandocaraballo/pi | /led-button.py | 711 |
null | null | null | null | class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
min_len = float('inf')
obj_str = ""
for item in strs:
if min_len >= len(item):
min_len = len(item)
obj_str = item
#这里额可以不取最短的,取第一个元素
i = 0
all... | 3.671875 | 4 | smollm | 1c19ac0adb23288f5f34f40e332753e062f16171 | sabergjy/Leetcode_Programing | /14.最长公共前缀.py | 1,358 |
null | null | null | null | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
prehead = ListNode()
curhead = prehead
while l1 and l2:
... | 3.875 | 4 | smollm | 07700486c569d327d6152181c89c28813878de92 | sabergjy/Leetcode_Programing | /21.合并两个有序链表.py | 1,207 |
null | null | null | null | import os
from os import listdir
from os.path import isfile, join
import pathlib
mypath = pathlib.Path(__file__).parent.absolute()
fileExtension = input("File Extension/substring you'd like to replace: ")
newFileExtension = input("New File Extension: (press 'Enter' if none: ")
onlyfiles = [f for f in listdir(mypath) i... | 3.53125 | 4 | smollm | b135f8ac378c3ebecf8993c6d59e070c1c668046 | mjp1997/File_Modif_Script | /File_Name_Modifier.py | 463 |
null | null | null | null | a = [ "Euclid", "Archimedes", "Newton","Descartes", "Fermat", "Turing", "Euler", "Einstein", "Boole", "Fibonacci", "Nash"]
vowels = ['A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U','u']
print(vowels)
if a[0][0] in vowels: # is E in Euclid (==a[0][0]) in the list of vowels ???
print('YES')
else:
print('NO')
j = 0
... | 3.703125 | 4 | smollm | 1838a0ee86dfdd644b47011de51194c8cb8ece62 | ElizabethBeck/Class-Labs | /BeckLab07.py | 962 |
null | null | null | null | class Board(object):
@staticmethod
def get_result(pos):
def get_board_algebraic():
board_head = list(map(chr, range(ord('a'), ord('h') + 1)))
board_lines = list(reversed(range(1, 9)))
board_algebraic = [[''] * 8 for i in range(8)]
for x in range(8):
... | 3.703125 | 4 | smollm | 0ff82b794739acf9a18caee6d7fccdda7e417303 | felipefln/chesshorse | /chesshorse/core/board.py | 1,068 |
null | null | null | null | import matplotlib.pyplot as plt
import numpy as np
if __name__ == '__main__':
x = np.zeros(360, dtype=np.float32)
x[180] = 1.0
T0 = np.identity(360, dtype=np.float32)
T = T0.copy()
n = 5
for i in range(1, n + 1):
T = T + np.concatenate([T0[:, i:], T0[:, 0:i]], axis=1)
T = T + n... | 3.609375 | 4 | smollm | eb8249ee149a5797d5837f35967ca9b07031be8d | ddreset/whoisit | /tasks/pascal.py | 507 |
null | null | null | null | from vertices import *
dict_of_roads = {}
road_neighbors = {}
road_direction = {}
count = 0
"""looping through all the keys in dict_of_vertices and storing their xy coordinates"""
for vert1 in dict_of_vertices:
vert1xy = dict_of_vertices[vert1]
for vert2 in dict_of_vertices:
"""repeating the same pro... | 4.15625 | 4 | smollm | ddb52e224a99a051e941ba0848a7aa4df63cd466 | camka14/Projects | /Python/Catan(Unfinished)/roads.py | 2,082 |
null | null | null | null | # multilevel inheritance
class MusicalInstruments:
numberOfKeys = 12
class Strings(MusicalInstruments):
typeOfWood = 'Tonewood'
class Guitar(Strings):
numberOfStrings = 6
def __init__(self):
print ("This Guitar has {} strings, it is made of {}, and has {} keys".format(self.numberOfStrings, self.typ... | 3.75 | 4 | smollm | 797c1d1b1fab0888f21b2ce836f0fde5029987b5 | amresh1495/Udemy-course-follow-up-code | /OOPS_MultiLevelInheritance.py | 366 |
null | null | null | null | def mat_mul (A, B):
num_lin_A, num_col_A = len(A), len(A[0])
num_lin_B, num_col_B = len(B), len(B[0])
assert num_col_A == num_lin_B
C = []
for linha in range(num_lin_A):
# Começando uma nova linha
C.append([])
for coluna in range(num_col_B):
# Adici... | 3.59375 | 4 | smollm | 36914d7d2c3c21c8f6645d1bcec87da07ea0d357 | Lay-RosaLauren/Coursera-Python-2 | /Week03/Multiplica_Matriz.py | 904 |
null | null | null | null | # Week 2 - Lista de Exercícios 2
# Exercício 2 - Menor nome
# Como pedido no primeiro vídeo desta semana, escreva uma função
# menor_nome(nomes) que recebe uma lista de strings com nome de pessoas como
# parâmetro e devolve o nome mais curto presente na lista.
# Aluno: Paulo Freitas Nobrega
# Recebe uma lis... | 4.28125 | 4 | smollm | f4b43a03d7cc62fe8e3b73e2aebbbebee993726e | Lay-RosaLauren/Coursera-Python-2 | /Week02/MN.py | 2,074 |
null | null | null | null | #!/usr/bin/python
import sys
import os
import util
if len(sys.argv) < 2:
print("Usage: %s <file> [port]" % sys.argv[0])
exit(1)
# Create a TCP/IP socket
FILENAME = sys.argv[1]
# Bind the socket to the port or choose a random one
address = util.getAddress()
port = None if len(sys.argv) < 3 else int(sys.argv[... | 3.5 | 4 | smollm | 375d1d279a806b2b26733f4ca8f9b2083bdae5d3 | secfb/HackingScripts | /upload_file.py | 899 |
null | null | null | null | #Hierarchical inheritance
class Student:
def __init__(self,usn=None,name=None,age=None):
self.usn=usn
self.name=name
self.age=age
def getdata(self):
self.usn=input("Enter the USN :")
self.name=input("Enter the name:")
self.age=int(input("Enter the age:"))
def display(self):
print("USN=",self.usn)
pri... | 3.96875 | 4 | smollm | a91b34dadf50da1d702334e635039550ccae64fa | Likitha-dotcom/Python_Lab | /Inheritance/hierarchical.py | 1,568 |
null | null | null | null | class WlasnaLista():
def __init__(self):
self.myList = []
def addList(self, x):
self.myList.append(x)
def removeFromList(self, x):
self.myList.remove(x)
def sortList(self):
self.myList.sort()
def __add__(self, other):
for x in other.mylist:
sel... | 3.8125 | 4 | smollm | f9784421b47569d8f1ba3d95da288c62e90720f4 | ShirkeJR/PythonLearn | /Zajecia29.11.2017/zad4.py | 503 |
null | null | null | null | lista = [1, 2, 3, 4, 5]
listb = [1, 6, 2, 9, 5]
for i in lista:
if i in listb:
print(i)
| 3.828125 | 4 | smollm | 86d2d40a090d36b6fe1d861c5b7b1d83ab603291 | liamdebell/liamdebell.github.io | /py/task5_c.py | 108 |
null | null | null | null | # first of all import the socket library
import socket
import pyautogui
import io
# next create a socket object
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("Socket successfully created")
# reserve a port on your computer in our
# case it is 12345 but it can byte anything
port = 20001
# Next bind to ... | 3.765625 | 4 | smollm | 32792dab1c2c96f78ccad1f4cca596840c999ef9 | lxf78/pc-remote-server | /server.py | 2,621 |
null | null | null | null | ##Norah Jean-Charles
##2/4/2019
##Polynomial Regression
##Dr.Aledhari
##CS4267-Machine Learning
##Section 1
##Spring 2019
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Import dataset
dataset = pd.read_csv('Propose-Salaries-Polynomial.csv')
#print(dataset)
X = dataset.iloc[:, 1:2].values
... | 3.703125 | 4 | smollm | 16f225587a80c48b421199cb548ec390286c1457 | NorahJC/RegressionAnalyses | /PolReg.py | 1,186 |
null | null | null | null | def my_func():
sum_final = 0
q = True
while q == True:
a = input('Введите числа через пробел ,если хотите закончить нажмите #').split()
print(a)
for i in a:
if i == '#':
q = False
break
else:
sum_final = sum_fin... | 3.90625 | 4 | smollm | 7318f5d7487cf6f80e96373f84936a2d1ce72397 | ermeksnow/geekbrains-python-homework | /example3-05.py | 415 |
null | null | null | null | number1 = int(input('введите число 1'))
number2 = int(input('введите число 2'))
string1 = input('введите строку')
print(number1)
print(number2)
print(string1)
| 3.734375 | 4 | smollm | 33420cb697cc886a8bd127aea0fabf3b96c6a879 | ermeksnow/geekbrains-python-homework | /exampl01.py | 197 |
null | null | null | null | #!/bin/python3
# Hackerrank
# Practice>Data Structures>Arrays>Left Rotation
import math
import os
import random
import re
import sys
def leftRotation(a, n, r):
if r % n == 0:
return a
else:
d = r % n
temp = []
for i in range(n):
if (i - d) >= 0:
temp... | 3.734375 | 4 | smollm | 5beb56b705fa637db5a79b5d3158086914f7a5e0 | skinan/Competative-Programming-Problems-Solutions-Using-Python | /LeftRotation.py | 678 |
null | null | null | null | # CodeForces
# 1145A- Thanos Sort
# April Fool Day Contest 2019
#Thanos Sort is a sorting algorithm which removes half of the list/array until it is perfectly balanced.
def thanos_sort(y):
for i in range(len(y) - 1):
if int(y[i]) > int(y[i + 1]): # If the list is not sorted in decreasing order.
... | 4.09375 | 4 | smollm | 10ebb56205fc6cbd07f6bc4cc6cf7cff5a814c4a | skinan/Competative-Programming-Problems-Solutions-Using-Python | /Thanos_Sort(1145A).py | 782 |
null | null | null | null | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
path = "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"
# assign column names to the dataset as follows −
headernames = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'Class']
dataset = pd.read_csv(pat... | 3.578125 | 4 | smollm | d2932c43a90a05dbf2dbc75595428eba8c8eae60 | Piyush-Ranjan-Mishra/python | /Machine Learning & AI/knn.py | 2,159 |
null | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 24 19:42:52 2021
@author: Gissela
"""
lista1= ["Juan",5,5.7,True,5]
print(type(lista1))
print(len(lista1))
tupla1=("Juan",5,5.7,False,5,True)
print(type(tupla1))
print(len(tupla1))
print(lista1[0],"\n")
print(lista1[1],"\n")
print(lista1[2],"\n")
print(l... | 3.5 | 4 | smollm | 125277acba7c6d677aa492bdf2c6ddb1079d9291 | Gisset/Python-Essential | /Ejercicio 3_24-06-2021.py | 491 |
null | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 28 19:55:39 2021
@author: Gissela
"""
def mult (a,b):
#print(a*b)
#return(a*b)
return(a*b,a+b,a/b,a**b,a//b,a%b)
#return
resultado=mult(5,5)
print(resultado[2])
#mult(5,5)
#print(mult(5,5))
| 3.921875 | 4 | smollm | 293f82e53c1156b5eaa0b4c9118197ebf3aa26a4 | Gisset/Python-Essential | /Ejercicio 7 28-06-2021.py | 270 |
null | null | null | null | # Построение графика
import matplotlib . pyplot как plt
импортировать numpy как np
х = нп . linspace ( 0 , 10 , 50 )
у = х
plt . title ( "Линейная зависимость y = x" )
plt . xlabel ( "x" ) # Ось x
plt . ylabel ( "y" ) # Ось y
plt . grid (... | 3.765625 | 4 | smollm | 3c449db12a7e72ad354f4cf0edc3f5710fd5617a | Rootny/- | /pypr 1.py | 635 |
null | null | null | null | # Given a string, write a function to check if it is a permutation of a palidrome.
# Input: Tact Coa
# Output: True (permutation: taco cat, atcocta
def checkPalindromePermutation(input_str):
letter_count = {}
lower_str = input_str.lower()
for letter in lower_str:
if letter <= 'z' and letter >= 'a':... | 3.953125 | 4 | smollm | aea79e3447e67018b765aefcec97ca73a7725e5d | RuiqingQiu/InterviewQuestions | /PalindromePermutation.py | 888 |
null | null | null | null | """RPG Character Generator.
Build a Character object that has some attributes and stats
characteristic of RPG characters. As a starting point, characters
tend to have some number of hit points that corresponds to their
health. They may have other stats that will augment their abilities,
like Strength, Intelligence, De... | 3.734375 | 4 | smollm | 32819b5cbed289ebac16663773fcc360c272f86c | musflood/character-generator | /character.py | 3,636 |
null | null | null | null | import sys, os, codecs
#get the command line argument
if len(sys.argv) < 2: sys.exit("Please enter a data directory path")
currentDir = sys.argv[1]
# get all the txt file paths from the given data directory
txtFilesList = [ os.path.join(currentDir, f) for f in os.listdir(currentDir) if (os.path.isfile(os.path.join(cu... | 3.5625 | 4 | smollm | b9794a3f794f1019afddacd5f86a3ab42622aef6 | zahikfir/NLP-Homeworks | /CorporaDrill/hw1_Q3.py | 1,116 |
null | null | null | null | import unittest
from prime_number.py import generate_prime
class generateprimeTestcase(unittest.Testcase)
def test_isprime(self):
self.assertEqual(generate_primes(5),(3,5))
def test_negative(self):
self.assertEqual(generate_primes(-1),'Return negative numbers')
def test_lessthantwo(self):
self.assertEqual(gen... | 3.734375 | 4 | smollm | a5f0681724b27b2c80050d85c27fdf2db2645e29 | codejunkiekenya/andelabootcamp17 | /prime_test.py | 491 |
null | null | null | null | s = " This is a cat"
##############################
def rev1(s):
#need memory usage
sr = ""
arr = s.split()
if len(arr) > 0:
for i in range(len(arr)-1,0,-1):
sr += arr[i] + " "
sr += arr[0]
return sr
##############################
def rev2(s):
#doesn't need memory
sr = ""
#find position of the ... | 3.734375 | 4 | smollm | 2a1a9f52221af07c92fa55c14a923237b0dc9a3f | skardash/reverse- | /reverse.py | 1,124 |
null | null | null | null | import csv
from Program1 import *
with open("Hweights.txt") as f:
reader=csv.reader(f)
h=list(reader)
HiddenW=[]
for i in range(len(h)):
s=h[i][0].split()
for j in range(len(s)):
s[j]=float(s[j])
HiddenW.append(s)
with open("Oweights.txt") as g:
readerr=csv.reader(g)
o=list(rea... | 3.546875 | 4 | smollm | 0b35c75db1161c28d5e5727a5c3d8e0a730a426b | NourAdel/GA | /Assignment4/Program2.py | 662 |
null | null | null | null | from pytrie import SortedStringTrie as Trie
from dicts.sorteddict import ValueSortedDict
from random import randint
import random
from sets import Set
import requests
import urllib2
import json
#Used in word frequencies to avoid counting the word in the next line as after a particular word as a new line is the eq... | 3.828125 | 4 | smollm | c7fec765417d2bf390a4aba63c8017fa5fb161ab | jasonscharff/Poetry-Generator | /main.py | 27,088 |
null | null | null | null | import time
import pandas as pd
import numpy as np
import json
CITY_DATA = { 'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv' }
CITIES = ['chicago','new york city', 'washington']
MONTHS = ['january', 'february', 'march', 'april', 'may', 'june', ... | 4.0625 | 4 | smollm | 448694645ee4c2b54f164404d36dc50ecffb0d01 | ebadeh/pdsnd_github | /bikeshare_2.py | 8,019 |
null | null | null | null | #Week_5_Class2.py
#counting
ccc=dict()
ccc['csev']=1
ccc['cwen']=1
print(ccc)
#{'csev': 1, 'cwen': 1}
ccc['cwen']=ccc['cwen']+1
print(ccc)
#{'csev': 1, 'cwen': 2}
counts=dict()
names=['csev','cwen','csev','zqian','cwen']
for name in names:
if name not in counts:
counts[name]=1
else:
... | 3.5 | 4 | smollm | 96b2ef664a4917b5a038b1ad255d34aa93baa0c8 | kateleecheng/Python-for-Everybody-Specialization | /2_Python Data Structures/Week_5_Class2.py | 1,041 |
null | null | null | null | #Week_4_Class3.py
abc='With three words'
stuff=abc.split()
print(stuff)
print(len(stuff))
print(stuff[0])
for w in stuff:
print(w)
line='A lot of space'
etc=line.split()
print(etc)#['A', 'lot', 'of', 'space']
line='first;second;third'
thing=line.split()
print(thing)#['first;secon... | 4.03125 | 4 | smollm | ca8e030672cb0f80854d78d3827e2a3030236ec1 | kateleecheng/Python-for-Everybody-Specialization | /2_Python Data Structures/Week_4_Class3.py | 755 |
null | null | null | null | L = ['a', 'b', 'c', 'd', 'e', 'f']
index = 1
x = L.pop(index)
print(f'The element {x} at index {index} was removed from the list')
print(f'The current list is {L}') | 3.765625 | 4 | smollm | 5a630b1f71f6476363e3f765a619a1ba6f394e4f | swati0806/Python | /pop.py | 164 |
null | null | null | null | import nltk
import urllib.request
import ssl
#retrieve the raw data from web and save it as txt
ssl._create_default_https_context = ssl._create_unverified_context
url = urllib.request.urlretrieve("https://raw.githubusercontent.com/AIHackers/DeepLearningStartUp/master/happiness_seg.txt","tt.txt")
#open and read it in p... | 3.65625 | 4 | smollm | 8af8f14c8f54ea0751c69b96db8a167964a1652a | Bob-Xin/DeepLearningStartUp | /mandatory.py | 1,701 |
null | null | null | null | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# 载入数据集
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
def max_pool(x):
return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],strides=[1, 2, 2, 1], padding='SAME')
x = tf.placeholder(tf.float32, [None, 784])
x_image = tf.resha... | 3.53125 | 4 | smollm | 3ebb979821351022988ebce27c9e3c7af56b290a | ChenQianPing/Py.Watermelon | /Tensorflow/手写体识别2.py | 2,906 |
null | null | null | null | #!/usr/bin/python
'''string="this is \n new line\n ends with\nand"
string1="this is new line ends withand"
print string.splitlines()
print string.capitalize()
print string.count("i")
print string1.center(100)
str1=string.encode('base64','strict')
print str1
print str1.decode('base64','strict')
print string.endswith('s... | 4.09375 | 4 | smollm | 25ad71141a3588efafa7cfcc6e305adf4c4925af | BRamamohan/python-notes | /python_practice/splitlines1 | 527 |
null | null | null | null | #!/usr/bin/python
'''
['_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'r... | 4.28125 | 4 | smollm | 004e6bc13edc4949d4f917beac123f67241af67f | BRamamohan/python-notes | /python_practice/startandend | 1,951 |
null | null | null | null | '''
Project 1 - CS157
Author: Arthur Tran
Date: 10-3-2019
As for what I would be counting as the basic operation, I think that counting the method 'canGoInLocation' as the basic operation
is a good idea. However within this method/function, there are multiple checks and a for loop going through each spot in the
coor... | 4.125 | 4 | smollm | 688807e0a953e9f2c521e8f6aec47b9f0841efd6 | atran06/Crossword-Solver | /crossword.py | 9,842 |
null | null | null | null | from math import *
import matplotlib.pyplot as plt
from pylab import *
def function(x):
fx = str_fx.replace("x", "%(x)f") # 所有的"x"换为"%(x)function"
return eval(fx % {"x": x}) # 字典类型的格式化字符串,将所有的"x"替换为变量x
# 绘图函数:给定闭区间(绘图间隔)
def drawf(a,b,interp=0.01):
x = [a+ele*interp for ele in range(0, int((... | 3.734375 | 4 | smollm | d6f7c4fbe918e9d23bece8e969d458c3bd680f22 | chengze123/StudyCode | /new_way.py | 2,379 |
null | null | null | null |
# Label format
# F = First letter of a first name, in uppercase
# L = Letters of last name, up to 5 in length, in uppcase
# N = Nationality, first letter uppercase
# XX = Age at death
# FFFFLLLLL-NXX
import csv
filename = "artists.tsv"
file = open(filename, "r")
parsed_data = csv.reader(file, dialect="... | 3.734375 | 4 | smollm | 9ef619d9cb8db766850ae3ff5864cdc357fe28d0 | tt-n-walters/saturday-advanced-python | /functional_programming/artist_labels.py | 1,032 |
null | null | null | null | min = 0
mid = 50
max = 100
guess = "Is your secret number: "
print"Please think of a number between 0 and 100!"
print guess + str(mid) + "?"
inp = raw_input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly. ")
while inp != 'c':
... | 3.96875 | 4 | smollm | ea9b856a9a340a88c21c0a9185cc46446b117ceb | divy-saxena95/week2 | /ques9.py | 796 |
null | null | null | null | #!/usr/bin/env python
from bond import *
from benchmarks import *
from curve import *
import csv
def main():
filename = input("Choose CSV file to import bond data: ")
benchmarks = {}
corp_list, gov_list = make_bond_list(filename)
benchmarks = get_benchmarks(corp_list, gov_list)
# CHALLENGE 1... | 3.59375 | 4 | smollm | e4cb373a21be8f059b30ca27f88118b86ee8fb9c | pbugash/overbond_devtest | /main.py | 1,152 |
null | null | null | null | num= input("enter a number")
num = int(num)
if num<=0:
print("the absolut value of ", num, "is",-num)
else:
print("the absolute value of", num, "is", num)
| 4.1875 | 4 | smollm | f8c88748c500817e5df10412665bc06adecedf21 | sane-nature/Basics | /if_satement.py | 175 |
null | null | null | null | # import get_long from cs50 library
from cs50 import get_float
# prompt user for a positive number
while True:
print("Enter credit card number: ")
cc_num = get_float()
# keep prompting user until we get a positive value
if(cc_num > 0):
break
# declare variables to keep track of digits and num... | 4.09375 | 4 | smollm | 2af9c30f7589c9d83077e89f8fc7f481629af250 | Bearsintours/CS50 | /PSET6/credit.py | 1,805 |
null | null | null | null | """Ekaterina (Katya) Bevinova
SSW-567-A
"""
def classify_triangle(a,b,c):
"""A function that tells if the triangle is Equilateral, Isosceles, Scalene and possibly right."""
try:
float(a) and float(b) and float(c)
if a == 0 or b == 0 or c == 0:
return "Cannot have 0 as a side."
... | 4.21875 | 4 | smollm | 3a9eee416cea22076d63566c1a08d53a8075cd3b | esbevinova/hw5 | /HW05.py | 1,027 |
null | null | null | null | from json.decoder import JSONDecodeError
import urllib, json
from urllib import request,error
from bs4 import BeautifulSoup
# http://climatedataapi.worldbank.org/climateweb/rest/v1/country/annualavg/tas/1980/1999/USA.json
with open('website.html') as html_file:
soup = BeautifulSoup(html_file.read(), features='htm... | 3.53125 | 4 | smollm | 1211b108c923011f8d9a9cc6d72926ad05ebeace | BirdmasterLance/HackMIT | /weathermanager.py | 1,672 |
null | null | null | null | import random
import time
import datetime
import calendar
import os
import shutil
# global config
start_time = time.time()
defaultMinNumber = 1
defaultMaxNumber = 5
defaultNumber = random.randint(defaultMinNumber, defaultMaxNumber)
fruits = ['orange', 'banana', 'anananas']
iterationCopy= 'Iteration '
notNumberCopy =... | 3.90625 | 4 | smollm | bcb88d083dff388c09031a934e82ab6354e9b330 | MichalObi/Python-playground | /simple_example.py | 3,581 |
null | null | null | null | from board import card_table, Board, ult_board
from os import system
from deck import total_card , normal_creation, special_creation, Deck, colors
import sys
import random
import time
class Player:
def __init__(self, name):
self.name = name
self.deck_of_player = []
self.score = 0
... | 3.59375 | 4 | smollm | b020a377e93c9a5df1e2aa3c8a169b427b233c7b | VladimirMMS/Pro-UNO | /players.py | 3,853 |
null | null | null | null | #!/usr/bin/env python
"""
This is the "Talking Clock" dailyprogrammer easy challenge.
https://www.reddit.com/r/dailyprogrammer/comments/6jr76h/20170627_challenge_321_easy_talking_clock/
>>> talking_clock('00:00')
"It's twelve am"
"""
def talking_clock(time):
""" Returns a string representing the time
Args:... | 4.375 | 4 | smollm | e7cb57303c3a4e15a6dafdae7782864824545e39 | pablomartinez/dailyprogrammer | /321/easy/talkingclock.py | 1,738 |
null | null | null | null | #!/usr/bin/env
def increment(n):
result = ''
for d in str(n):
result += str(int(d)+1)
return int(result)
def numerical_increment(n):
remain = n
pos = 0
result = 0
while remain:
d = remain % 10
remain = remain // 10
result += (d+1)*(10**pos)
if d==9:
... | 3.921875 | 4 | smollm | 65bd69457cd8bdcabfe836e9c51d47a85dfeac47 | pablomartinez/dailyprogrammer | /375/easy/increment_digit.py | 392 |
null | null | null | null | full_name = input('Enter your name: ')
list_of_names = full_name.split()
for index, name in enumerate(list_of_names):
if name[0].islower():
del list_of_names[index]
[print(name[0] + '.', end='') for name in list_of_names] | 3.828125 | 4 | smollm | 6de5400e9a9302f31fbc9441bdb741550a7e4cf5 | KristianMariyanov/PythonPlayground | /softuni-course/Lecture02/initials.py | 236 |
null | null | null | null | import turtle
turtle.speed('fastest')
screen = turtle.Screen();
i = 10
for _ in range(750):
turtle.left(i % 48)
turtle.forward(10)
i += 1
turtle.up()
turtle.setposition(0, 100)
turtle.down()
turtle.left(110)
turtle.forward(200)
screen.exitonclick()
| 3.5625 | 4 | smollm | ef4b18e1fe641ea319ee5b824b455b7f8e4a0e6a | KristianMariyanov/PythonPlayground | /softuni-course/Lecture01/draw_beauty.py | 267 |
null | null | null | null | #!/usr/bin/env python
# RMS 2018
# A genetic algorithm to aid in feature selection in machine learning problems
import multiprocessing as mp
import numpy as np
from sklearn.model_selection import train_test_split
class GeneticAlgorithm(object):
def __init__(self, X, Y, model, Niter=100, keep_fraction=0.5, mu... | 3.65625 | 4 | smollm | fb02a5be5e5727f22b15efec1ce2855986f9d2fe | rmartinshort/GeneticAlgorithm | /geneticalgorithm/geneticalgorithm.py | 9,816 |
null | null | null | null | """Script to extract features from documents."""
import math
from typing import List
def idf_single_term(term: str, documents: List[List[str]]) -> float:
"""Calculates the inverse document frequency (idf) for a single term given a list of documents.
Args:
term: The term to be scored.
document... | 3.90625 | 4 | smollm | e4d600521139bb89ceba410a1167030c71228d2a | capivara-ai/milkqa-utils | /milkqa_utils/feature_extraction.py | 596 |
null | null | null | null |
from tkinter import *
root=Tk()
def printName(event):
print("Hi, My name is Vasudeva")
button = Button(root,text="Click me")# we can keep command=function_name to invoke the function also
button.bind("<Button-1>",printName)# here Button 1 indicates the leftclick.Note the function name houldn't contai... | 3.90625 | 4 | smollm | c3a406e8cfe6638d33c3e9f30e1be1408919f68a | Vasudeva1997/UrvashiVasudeva | /PycharmProjects/GUI/BindingFunctions.py | 373 |
null | null | null | null |
from tkinter import *;
root=Tk()
l1=Label(root,text="One",bg="red",fg="white")#fg= foreground bg=backgroung
l1.place(x=0,y=0)
e=Entry(root)
e.place(x = 50, y=0 , width="200",height ="20")
print(e.get())
root.mainloop() | 3.828125 | 4 | smollm | c9bf9c8f275209b4af4e6836eb17184c05ece4fa | Vasudeva1997/UrvashiVasudeva | /PycharmProjects/GUI/entryBox.py | 229 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.