Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
5
121k
import shutil import os class changed_dir: """ Changes into a arbitrary directory, switching back to the directory after execution of the with statement. directory: the directory that should be changed into. create_if_not_exists: set this to False, if the chgdir should fail loudly. ...
def coinChange(values, money, coinsUsed): for cents in range(1, money+1): minCoins = cents for value in values: if value <= cents: temp = coinsUsed[cents - value] + 1 if temp < minCoins: minCoins = temp coinsUsed[c...
import numpy as np import pandas as pd import sklearn from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt df = pd.read_csv("student-por.csv", sep=';') df = df[['G1', 'G2', 'G3', 'studytime', 'failures', 'freetime', 'goout', 'health', 'absences']] outputPrediction = 'G3' x = ...
import unittest from cryptography_toolkit import encrpytion as en class EncryptionTest(unittest.TestCase): def test_reverse_cipher(self): self.assertEqual(en.reverse_cipher("Lorem ipsum dolor sit amet, consectetur adipiscing elit."), ".tile gnicsipida rutetcesnoc ,tema tis rolod m...
def fibo(n_int): if n_int == 0: return 0 if n_int == 1: return 1 if n_int >= 2: return (fibo(n_int-1)+fibo(n_int-2)) def fib(n): if isinstance(n,float): print('The input argument {} is not a non-negative integer!'.format(n)) elif isinstance(n,str): ...
import turtle length = eval(input("Enter the length of a star: ")) turtle.penup() turtle.goto(0, length / 2) turtle.pendown() turtle.right(72) turtle.forward(length) turtle.right(144) turtle.forward(length) turtle.right(144) turtle.forward(length) turtle.right(144) turtle.forward(l...
code = eval(input("Enter an ASCII code: ")) print("The character for ASCII code", code, "is", chr(code))
weight = eval(input("Enter weight in pounds: ")) feet = eval(input("Enter feet: ")) inches = eval(input("Enter inches: ")) height = feet * 12 + inches bmi = weight * 0.45359237 / ((height * 0.0254) * (height * 0.0254)) print("BMI is", bmi) if bmi < 18.5: print("Underweight") elif bmi...
"""Print out all the melons in our inventory.""" melon_info = { 'Honeydew': [True, 0.99], 'Crenshaw': [False, 2.00], 'Crane': [False, 2.50], 'Casaba': [False, 2.50], 'Cantaloupe': [False, 0.99] } def print_melon(melon_info): """Print each melon with corresponding attribute information.""" ...
from threading import Thread import time g_num = 0 def test1(): global g_num for i in range(1000000): g_num +=1 print("-----test1-----g_num=%d"%g_num) def test2(): global g_num for i in range(1000000): g_num += 1 print("----test2----g_num=%d"%g_num) p1 = Thread(target=test1) p...
i=0 while i<=100: print("%d"%i,end="-") i=i+1 if i==100: print("\n")
def quick_sort(alist,first,last): if first>=last: return mid_value = alist[first] low = first high = last while low < high: while low < high and alist[high] >= mid_value: high -= 1 alist[low] = alist[high] while low < high and alist[low]...
class Test(object): def __init__(self): self.__num = 100 def setNum(self,newNum): print("----------setter-------") self.__num = newNum def getNum(self): print('-----------getter------') return self.__num num = property(getNum,setNum) t =Test() print(t.getN...
prices = { 'ACME':45.23, 'AAPL':612.78, 'IBM':205.55, 'HPQ':37.20, 'FB':10.75 } p1 = {key:value for key,value in prices.items() if value>200} p1 = dict((key,value) for key,value in prices.items() if value>200) print(p1) tech_names = {'AAPL','IBM','HPQ','MSFT'} tech_names = {key:value for key,va...
import random nearby_offsets = [(-1, 0), (0, 1), (1, 0), (0, -1), (-1, -1), (-1, 1), (1, -1), (1, 1)] def print_board(board): """ Prints board in 2D format board - 2D list of mine locations """ d = len(board) for i in range(d): print("==", end='') print() ...
def fibonacci(n): ''' This is a fibonacci series function. Comment ''' a, b = 0, 1 while n > 0: a, b = b, a+b n -= 1 return a assert fibonacci(0) == 0 assert fibonacci(1) == 1 assert fibonacci(2) == 1 assert fibonacci(3) == 2 assert fibonacci(5) == 5
person = {'first_name':'Ringo','last_name':'Starr'} person['instrument'] = 'drums' person['born'] = 1940 print(person['first_name'] + ' was born in ' + str(person['born']))
person={'name':'Lisa', 'age':29} print(person) person['school'] = 'SNHU' print(person)
import sys numbers= sys.argv[1].split(',') numbers= [int(i) for i in numbers] index = 0 maxVal = 0 maxIndex = index for index in range(0, len(numbers)): if numbers[index] > maxVal: maxVal = numbers[index] maxIndex = index print(maxIndex)
import sys text= sys.argv[1] def isRed(str): found = str.find('red') if found >= 0: return True else: return False print(str(isRed(text)))
persons=[{'name':'Lisa','age':29,'school':'SNHU'}, {'name': 'Jay', 'age': 25, 'school': 'SNHU'}, {'name': 'Doug', 'age': 27, 'school': 'SNHU'}] print(persons) print(persons[1]['name'])
from collections import deque ''' deque: - stacks and queues (double ended queue0 - thread-save, memory efficient appends and pops from either side of the deque O(1) ''' queue = deque('Breadth-1st Search') queue.append('algorithm') queue.appendleft('hello') for i in queue: print(i) print(f'size: {len(que...
name=(input("Enter your name:")) print("-------------------------------------------------------------------------------------------") a=print("1-Add expense:") b=print("2-Read expense report:") c=print("3-Email expense report:") ans=int(input("Enter your choice:")) def database(): global database global ans ...
from datetime import datetime class Employee: """Construct employee class and its members/operations""" def __init__(self,EmployeeId,Name,DOB,SSN,State): """Initialize the employee and return a new employee object. """ self.EmployeeId = EmployeeId name = Name.split(" ") ...
name = str(input("Name: ")).title() for n in name: if n.isupper(): print(n, end=" ")
jogador = dict() jogadores = list() gols = list() while True: jogador.clear() jogador['nome'] = str(input('Nome do Jogador: ')) partidas = int(input(f'Quantas partidas {jogador["nome"]} jogou? ')) for i in range(0, partidas): gols.append(int(input(f"Quantos gols na partida {i + 1}: "))) ...
lista = input().split(" ") lista2 = input().split(" ") codigo_peca = int(lista[0]) numero_de_peca = int(lista[1]) valor_pecas = float(lista[2]) codigo_peca2 = int(lista2[0]) numero_de_peca2 = int(lista2[1]) valor_pecas2 = float(lista2[2]) valor_total = (numero_de_peca * valor_pecas) + (numero_de_peca2 * valor...
dados = input().split(" ") a = float(dados[0]) b = float(dados[1]) c = float(dados[2]) pi = 3.14159 triangulo = (a * c) / 2 circulo = (c ** 2) * pi trapezio = (( a + b) * c) /2 quadrado = b * b retangulo = a * b print("TRIANGULO: %0.3f" %triangulo) print("CIRCULO: %0.3f" %circulo) print("TRAPEZIO: %0.3f" %trapezio)...
ficha = list() while True: nome = str(input('Nome: ')) nota1 = float(input('Nota 1: ')) nota2 = float(input('Nota 2: ')) media = (nota1 + nota2) / 2 ficha.append([nome, [nota1, nota2], media]) resp = str(input('Quer continuar? S/N: ')) if resp in 'Nn': break print('-='*30) print(f'{"...
tamanho = 3 for i in range(tamanho): for j in range(1,tamanho+1): if j == tamanho - i: for b in range(tamanho, j-1, -1): print("#", end='') break print(" ", end='') print()
numeros = input().split(" ") a = int(numeros[0]) b = int(numeros[1]) c = int(numeros[2]) d = int(numeros[3]) if ((a % 2 == 0) and (b > c) and (d > a) and ( c + d > a + b)): print("Valores aceitos") else: print("Valores nao aceitos")
lista = [[0,0,0], [0,0,0],[0,0,0]] for l in range(0,3): for c in range(0,3): lista[l][c] = int(input(f'Digite um valor na posição: [{l},{c}] ')) for l in range(0,3): for c in range(0,3): print(f'[{lista[l][c]:^5}]', end='') print()
def fatorial(num=1, show=True): if show: fat = num for i in range(1, num + 1): if fat != 1: print(f'{fat}', end=' x ') else: print(f'{fat}', end=' = ') fat -= 1 for i in range(1, num): num *= i print(f'{num}') fat...
num = {} num[1] = 1 def seq(x): if x in num: return num[x] if x % 2: num[x] = seq(3 * x + 1) + 1 else: num[x] = seq(x / 2) + 1 return num[x] largest = 0 for i in range(1, 1000001): if largest < seq(i): largest = seq(i) index = i print (index, largest)
class Woman(): money =1000000 house =10 __yi_wu = '裙子' def __init__(self,a): self.a = a def skill(self): print('吃喝玩乐')
'''f = open("zaid.txt","rt") content=f.read(10) # it will read only first 10 character of file print(content) content=f.read(10) # it will read next 10 character of the file print(content f.close() # must close the file in every program''' '''f = open("zaid.txt","rt") content=f.read() # it will read all the files pr...
class Employees: no_of_l=8 def __init__(self,aname,asalary): self.name=aname self.salary=asalary def printdetails(self): return f"Namae is {self.name}. salary is {self.salary}" @classmethod def change_leaves(cls,newleaves): cls.no_of_l=newleaves def __add__(self, ...
'''enumerate functions: use for to easy the method of for loop the with enumerate method we can find out index of the list ex: list=["a","b","c"] for index,i in enumerate(list): print(index,i) ''' ''' if ___name function : print("and the name is ",__name__)# it will give main if it is written before if __name__ =...
from abc import ABC,abstractmethod class shape(ABC): @abstractmethod def printarea(self): return 0 class Rectangle(shape): type= "Rectangle" sides=4 def __init__(self): self.length=6 self.b=7 harry=Rectangle()
''' recursive and iterative method; factorial using iterative method: # using iterative method def factorialiterative(n): fac=1 for i in range(n): print(i) fac=fac*(i+1) return fac # recusion method which mean callingthe function inside the function def factorialrecursion(n): if n==1: ...
sentences=["python is python very good laguage","python python is python is cool","python is awesome","javascript is good"] import time inp=[x for x in (input("enter the word you want to search").split())] searchmatch=[] c=time.time() for search in inp: a = 0 for i in sentences: a = 0 d=i.sp...
class age: cy=2020 def year(self): print(f"you will become 100 year old at the year{a+100}") def ages(self): print(f"you will become 100 year old at the year {age.cy-a + 100}") if __name__ == '__main__': print("to tell you in which year you will become 100...
if __name__ == '__main__': a = int(input()) b = int(input()) intdiv = a//b floatdiv = a/b print(intdiv) print(floatdiv)
class Solution: def search(self, A, target): B=list(set(A)) return find(B,target,0,len(B)-1) def find(A,target,start,end): if A==[]: return False if start+1<len(A): if A[start]==A[start+1]: del A[start] return find(A,target,start,end-1...
class Solution: def findMin(self, num): return findPeak(num,0,len(num)-1) def findPeak(A,start,end): if A[start]<A[end] or start==end: return A[start] else: if end-start==1: return A[end] elif A[int((start+end)/2)]>A[int((start+end)/2)+1]: ...
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def addTwoNumbers(self, l1, l2): i1=1 i2=1 num1=0 num2=0 while True: num1+=l1.val*i1 if l1.next==None: break ...
def cover_number(s) : try: print("this function's value:", s) return int(s) except ValueError: return None ''' a = cover_number('python') print(a) b = cover_number(12305) print(b) ''' stuff = input("> ") print("input value:",stuff) words = stuff.split() print("split value:",words) ...
def add(a,b): print("ADDING %d + %d " % (a,b)) return a + b def substract(a,b): print("SUBTRACT %d - %d " % (a, b)) return a - b def multiply(a,b): print("MULTIPLY %d * %d " % (a,b)) return a * b def divide(a,b): print("DEVIDE %d / %d" % (a,b)) return a / b print("Let's do some ma...
print("How old are you?",end="") age = input() print("How tall are you?",end="") height = input() print("How much do you weight?",end="") weight = input() print("So you're %r old,%r tall and %r heavry." %(age,height,weight))
cities ={'CA':'San Francisco','MI':'Detroit','FL':'Jacksonville'} cities['NY'] = 'New York' cities['OR'] = 'Portland' def find_city(themap, state) : if state in themap: return themap[state] else: return "Not found." cities['_find'] = find_city while True : print("State? (ENTER to quit...
from dataclasses import dataclass from typing import List @dataclass class QuestionResponse: """ Interface that represents the response of one question. """ answer_id: int question_id: int justification: str = None @dataclass class FormCompanyResponse: """ Interface that represen...
tpl = (1, 2, 3, "Hello", 3.5, [4,5,6,10]) print(type(tpl)," ",tpl,"\n") print(tpl[5]," ",tpl[-3]) for i in tpl: print(i, end=" ") print("\n") li = list(tpl) print(type(li),' ',li,"\n") tpl2 = 1,2,3 print(type(tpl2)," ",tpl2) a,b,c = tpl2 print(a," ",b," ",c) t = (1) print(type(t)) t1 = (1,) print(type(t1)) ...
fw = open('sample.txt','w') fw.write('Writing some stuff in my text file\n') fw.write('Barun Bhattacharjee') fw.close() fr = open('sample.txt','r') text = fr.read() print(text) fr.close()
def main(): n = int(input()) str = '' for i in range(1,n+1): str = str + f"{i}" print(str) if __name__=="__main__": main()
from sys import argv script, input_file = argv def print_all(f): print(f.read()) def rewind(f): f.seek(0) ''' fp.seek(offset, from_what) where fp is the file pointer you're working with; offset means how many positions you will move; from_what defines your point of reference: 0: means your reference point is...
str1 = "Barun " str2 = "Hello "+"World" print(str1+" "+str2) ''' To insert characters that are illegal in a string, use an escape character. An escape character is a backslash \ followed by the character you want to insert. ''' str3 = 'I don\'t think so' print(str3) print('Source:D \Barun\Python files\first project....
import calendar year = int(input('Enter a year number: ')) calendar.prcal(year) import math fact = int(input('Enter a number: ')) print('The Factorial of ',fact,'is: ',math.factorial(fact))
import numpy as np import pandas as pd import matplotlib.pyplot as plt data = pd.read_csv("train.csv") null = data.isnull().sum() data.workclass.value_counts(sort=True) data.workclass.fillna('Private',inplace=True) data.occupation.value_counts(sort=True) data.occupation.fillna('Prof-specialty',inpl...
import random def search(letter, word): n=0 i=0 for x in word: if letter==x: n=i i= i+1 word=[ 'apple', 'notebook', 'phone', 'monitor', 'coconut', 'burrito', 'convertible', 'mansion', 'unorthodox', 'hangman'] i=(random.randint(0,9)) man=word[i] x=len(man) tries...
import requests import csv url = "https://api.spacexdata.com/v3/launches" response = requests.get(url) with open("flights.csv", mode='w') as flights_file: csv_w = csv.writer(flights_file) csv_w.writerow([ "flight_number:", "mission_name:", "rocket_id:", "rocket_num...
import math import numpy as np import pandas as pd import matplotlib.pyplot as plt import sklearn as sk import scipy as sp from sklearn.ensemble import RandomForestClassifier,RandomForestRegressor from sklearn.experimental import enable_iterative_imputer from sklearn.impute import IterativeImputer train = pd...
class Hiring: def __init__(self, title, skills, location): self.title = title self.skills = skills self.location = location def listjob(self): print('We have a current job opening for a ' + str(self.title) + ' who is skilled in ' + str(self.skills) + '. The position is ...
import collections class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def inorderTraversal(self, root: TreeNode) -> [int]: result, curr, stack = [], root, [] while len(stack) or curr: while curr:...
class Solution: def rotate(self, matrix: [[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ size = len(matrix) l = size - 1 for row in range(0, int(size/2)): for column in range(0, int((size + 1)/2)): ...
from tkinter import * root=Tk() root.minsize(600, 300) root.resizable(0, 0) lbl=Label(root,text="Sanjay\nGoyal\nBhind",font=("Arial",15),bg='lightgreen',fg='black',width=40, height=3) lbl.pack() root.mainloop()
def count_substring_length(string : str) -> int : seen = dict() last_index = 0 max_len = 0 for i in range(len(string)) : if string[i] in seen : last_index = max(last_index, seen[string[i]] + 1) seen[string[i]] = i max_len = max(max_len, i - last_index + 1) ...
class Person(object) : def __init__(self, name, age) : self.name = name self.age = age def __str__(self) : return "Name = {} and age = {}".format(self.name, self.age) if __name__ == "__main__": mylist = [ Person('Ankit', 22), Person('Priya', 20), Perso...
class Solution : def find_union(self, arr1, arr2) : i, j = 0, 0 while i < len(arr1) and j < len(arr2) : if arr1[i] < arr2[j] : print(arr1[i], end = " ") i+=1 elif arr2[j] < arr1[i] : print(arr2[j], end = " ") ...
def find_duplicate(arr : list) -> None : slow = arr[0];fast = arr[0] slow = arr[slow] fast = arr[arr[fast]] while slow != fast : slow = arr[slow] fast = arr[arr[fast]] fast = arr[0] while slow != fast : slow = arr[slow] fast = arr[fast] return slow ...
""" python program to move all the negative elements to one side of the array ------------------------------------------------------------------------- In this, the sequence of the array does not matter. Time complexity : O(n) space complexity : O(1) """ def move_negative(arr : list) -> None : left = 0;right...
""" Equal Strings ------------- You are given N strings, You have to make all the strings equal if possible. Output : Print the minimum number of moves required to make all the strings equal or -1 if it is not possible to make them equal at all """ def min_moves(arr : list) -> int : arr.sort() min_move...
def pangrams(string : str) : string = string.upper() alpha = [0]*26 for el in string : if el.isalpha() : alpha[ord(el) - 65] += 1 return all(alpha) if __name__ == "__main__": print(pangrams("ankit"))
def rotate_string(string : list, i : int, j : int) -> None : while i <= j : string[i], string[j] = string[j], string[i] i+=1;j-=1 def main() : t = int(input()) for _ in range(t) : original_string = input() fake_string = list(input()) temp = fake_string.copy() ...
def decode_message(string) : res = list() for el in string : next_char = chr(ord(el) - 3) if ord(el) - 3 < 65 : next_char = chr(ord(el) - 3 + 26) res.append(next_char) return res if __name__ == '__main__' : string = input() res = decode_message(string) ...
''' 200. Number of Islands Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example 1: Input: 11110 11010 11...
import curses stdscr = curses.initscr() curses.start_color() curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) curses.init_pair(2, curses.COLOR_GREEN, curses.COLOR_BLACK) curses.init_pair(3, curses.COLOR_BLUE, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK) curses.ini...
fig = dict({ "data": [{"type": "bar", "x": [1, 2, 3], "y": [1, 3, 2]}], "layout": {"title": {"text": "A Figure Specified By Python Dictionary"}} }) import plotly.io as pio print(range(1,101))
import standard_math def main(): res = sum(len(standard_math.num_to_word(i))for i in range(1, 1001)) return str(res) print(main())
x=10 def fun1(): print("x=x+1 this statement produces error as this function treats x as a local variable") def fun2(): global x x=x+1 print(x) fun1() fun2()
print("Reading operation from a file") f2=open("newfile2.txt","w") f2.write(" Hi! there\n") f2.write("My python demo file\n") f2.write("Thank u") f2.close() f3=open("newfile2.txt","r+") print("Method 1:") for l in f3: print(l,end=" ") f3.seek(0) print("\nMethod 2:") print(f3.read(10)) f3.seek(0) print("Method 3:"...
import turtle from turtle import * from random import randint wn=turtle.Screen() wn.bgcolor("light yellow") wn.title("Race") turtle.pencolor("dark blue") penup() goto(-200,200) write("RACE TRACK!!",align='center') goto(-160,160) for s in range(16): write(s) right(90) forward(10) pendown() forward(15...
N = int(input()) H = int(input()) R = float(input()) salario = float(H * R) print ("NUMBER = %d" %N) print("SALARY = U$%.2f" %salario)
import re from collections import namedtuple Token = namedtuple('Token', ['type', 'value', 'lineno', 'columno']) def tokens(source, definitions, ignore_case=True): """Yield a token if part of the source matched one of the token definitions.""" re_definitions = [ (re.compile(t_def[0], re.I), ...
class my_list: def __init__(self): self.l1 = [] self.l2 = [] def put(self,value): self.l1.append(value) def pop(self): if self.l2: return self.l2.pop(-1) while self.l1: self.l2.append(self.l1.pop(-1)) if self.l2: ...
class Node(): def __init__(self,value): self.value = value self.parent = None self.left = None self.right = None def get_next(node): p_next = None if node.right: p = node.right while p: p = p.left p_next = p else: while p.parent and p....
import random class My_list(): def __init__(self,value): self.value = value self.next = None def get_list(li): p = None p1 = p for i in li: n1 = My_list(i) if not p: p = n1 p1 = p else: p1.next = n1 p1 = p1.next ...
jak=int(input()) jak=str(jak) fa=0 for i in range(0,len(jak)): if(jak[i]=='0' or jak[i]=='1'): fa=1 else: fa=0 break if(fa==1): print('yes') else: print('no')
nu=[int(i) for i in input().split()] nu1=nu[0]*nu[1] if nu1 % 2 == 0: print("even") else: print("odd")
import numpy as np matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) print(np.max(matrix)) print(np.min(matrix)) print(np.max(matrix, axis=0)) print(np.max(matrix, axis=1))
from listprime import listprimes from math import sqrt def factor(number): factors = list([]) for i in listprimes(sqrt(number)+1): if (number % i == 0): factors.append(i) factors.extend(factor(number/i)) return factors if number != 1: facto...
import random class nimble: def __init__(self): self.board = []; self.pawn = 0; def newBoard(self, n, p): self.pawn = p; for i in range(0, n): self.board.insert(i, 0); for j in range(1, p + 1): ran = random.randint(0,...
fo = open('text.txt', 'w') print('Name',fo.name) print('Is closed?', fo.closed) print('Opening mode', fo.mode) fo.write('I love python') fo.write(', javascript') fo.close() fo = open('text.txt', 'a') fo.write(' and I guess php') fo.close() fo = open('text2.txt', 'w+') fo.write('This is a new file') fo.close()...
from scienceFunctions import georand from random import randint from random import random def linCombRand(database): """ Takes a random number of points from the database and returns a vector that is a randomly weighted linear combination of the points. """ numPoints = geora...
def matrixMultiplication(matrixA, matrixB): if type(matrixA) == int and type(matrixB) == int: return matrixA * matrixB elif type(matrixA) == int and type(matrixB) == list: solution = [] for row in matrixB: solutionRow = [] for col in row: solutionRow.append(col * matrixA) solution.append(solutionRo...
class Node(object): def __init__(self): self.left = None self.right = None self.data = None root = Node() n1 = Node() n2 = Node() n3 = Node() n4 = Node() n5 = Node() n6 = Node() root.data = "root" root.left = n1 root.right = n2 n1.data = 1 n2.data = 2 n1.left = n3 n1.right = n4 n3.data...
import pandas countryCoordinates = {} def countryCounts(data,year): counts = {} for (i,country) in enumerate(data["Country"]): if country in counts: counts[country] += 1 else: counts[country] = 1 countryCoordinates[country] = (data.loc[i,"Lat"],data...
from pathlib import Path data_folder = Path(".").resolve() symb_to_num = {"A": 1, "B": 2, "C": 3, "X": 1, "Y": 2, "Z": 3} def parse_data(data): games = [[symb_to_num[symb] for symb in game.split()] for game in data.split("\n")] return games def score(game, new_interpretation): if new_interpretation: ...
from pathlib import Path import numpy as np def main(): serial = 8141 print(find_best_square(serial,3)) print(find_best_square(serial)) def find_best_square(serial,square_size=None): size = 300 gen = np.arange(size)+1 X = np.tile(gen,(size,1)) Y = np.copy(X.T) p = X+10 p *= Y ...
from pathlib import Path from collections import defaultdict data_folder = Path(".").resolve() def parse_data(data): cave_connections = [line.split("-") for line in data.split("\n")] connected_to = defaultdict(list) for line in cave_connections: connected_to[line[0]].append(line[1]) conne...
import numpy as np def palindromos(): ''' Retorna uma lista de números palíndromos formados pela multiplicação entre outros dois números de dois dígitos''' palindromos = [] for i in range(1, 1000): for j in range(1, 1000): p = i * j s = str(p) ...
End of preview. Expand in Data Studio

SmolPyEdu

This dataset aims to be a very solid option for pre-training general-purpose or coding/programming SLMs and TLMs.

It takes Avelina/python-edu-cleaned, filters for only working scripts, removes all comments, and leaves only clean, short scripts.

It inherits the same odc-by license as the source.

Dataset Details

  • Curated by: MoreThought
  • Funded by: MoreThought
  • Shared by: MoreThought
  • License: odc-by

Dataset Sources

Uses

  • Pre-training general-purpose or coding/programming SLMs and TLMs
  • Pre-training general-purpose or coding/programming LLMs of any kind in general
  • Post-training general-purpose or coding/programming SLMs and TLMs to stop using comments

Stats

Total compressed size Max script size Size reduction VS used
2.18 GB 100 lines 2.775x
Downloads last month
8

Collections including MoreThought/SmolPyEdu