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
def lines(line1, line2): if(type(line1) != str or type(line2) != str): return('0') elif(line1 == line2): return('1') elif(len(line1) != len(line2)): if(line2 == 'learn'): return(3) elif(len(line1) > len(line2)): return(2) else: retu...
3.90625
4
smollm
f0ba00dd33c192c9c8a95d689ddf471dabfdb95d
FILLIPP332/homework1
/if_else/ifelse2.py
443
null
null
null
null
"""This file contains functions to scrap news websites and format the results for easy reading""" #Python 3.x import requests, json #newsapi.org with open ("passwords.txt", "r") as myfile: keysAndPasses = myfile.read() keysAndPasses = eval(keysAndPasses) NEWS_API_KEY = keysAndPasses["NEWS_API_KEY"] BASE_URL = "...
3.671875
4
smollm
ac1b6d7f319214b73d24604b00c804b38f55f529
evvanErb/DailyDigest
/newsScrapper.py
2,048
null
null
null
null
from threading import Thread import time import socket class WorkerThread(Thread): """ Class used for overriding the default thread constructor, and running each thread. """ def __init__(self, kind, network, debug = False, Stopper = False): """ Initialize the class attributes as outlined here: * kind -- s...
3.75
4
smollm
3ab3706f0a0825405a461ceea33bb1c6314668d3
mpavlak25/ChatClient
/WorkerThread.py
1,603
null
null
null
null
from typing import List class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ zero = 0 non_zero = 0 n = len(nums) while True: while zero < n and nums[zero] != 0: ...
3.5625
4
smollm
287da5098f44a119185cb596941f13bcc0870c4e
lisiur/leetcode
/solutions/move_zeroes/solution.py
911
null
null
null
null
import unittest from solutions.reverse_integer.solution import Solution class TestReverse(unittest.TestCase): def test_1(self): u_input = { 'x': 123 } u_output = 321 solution = Solution() u_result = solution.reverse(**u_input) self.assertEqual(u_output...
3.65625
4
smollm
fa0091f5246d0afcdcbc737a37ab1e2681a49ab4
lisiur/leetcode
/tests/test_reverse_integer.py
1,263
null
null
null
null
import pprint message = 'Hello, python; I am studing python language, I studied python two weeks all ready !' dict2 = {} for str1 in message: dict2.setdefault(str1, 0) dict2[str1] = dict2[str1] + 1 for k, v in dict2.items(): print(k + ":" + str(v) + '\n') print(dict2) pprint.pprint(dict2)
3.796875
4
smollm
c9f18dad1a73b77c2882c491efd2523f8766d21b
dongshuicen/py_practice1
/practice/CharactersCount.py
301
null
null
null
null
#Isaac #9/19 #Math Lab - Triangles #create and asigne values to base and height base = 10 height = 5 #Calculate area area = 0.5*base*height print(area) area_type = type(area) print(area_type)
3.53125
4
smollm
f43356705c6dba9b8870af785f1e6ac9e3d57f95
IsaacLeh1/In-class-examples
/Chapter 2/Math Lab Triangles.py
209
null
null
null
null
import datetime def main(): day = int(input().split()[1]) hour = input().split() date0 = datetime.datetime( 2020, 4, day, int(hour[0]), int(hour[2]), int(hour[4]), 0 ) day = int(input().split()[1]) hour = input().split() date1 = date...
3.71875
4
smollm
4964c9c265513d0440e4021cf82449309ccdb07c
Dairo01001/python_URI
/URI_1061.py
799
null
null
null
null
def main(): n = int(input()) a = n // 365 n = n - (365 * a) m = n // 30 n = n - (30 * m) print(f'{a} ano(s)') print(f'{m} mes(es)') print(f'{n} dia(s)') if __name__ == '__main__': main()
3.5
4
smollm
3bdd2a2832d2ef281d92c196c7b7f0c6c6336bfd
Dairo01001/python_URI
/URI_1020.py
225
null
null
null
null
def main(): x = int(input()) y = int(input()) sum_impares: int = 0 for i in range(min(x, y) + 1, max(x, y)): sum_impares = sum_impares + i if i % 2 != 0 else sum_impares print(sum_impares) if __name__ == '__main__': main()
3.515625
4
smollm
77d6bfce0800e4c2d50bfccfa6aad57b01946599
Dairo01001/python_URI
/URI_1071.py
259
null
null
null
null
import sys, string, math a = input() a = a.lower() s2 = string.ascii_lowercase for b in s2 : if b not in a : print('no') sys.exit() print('yes')
3.828125
4
smollm
76e5a66ee24f225889ccf5d6256d989521626a57
tabassumhajira/pro
/06pro03.py
165
null
null
null
null
primeiro = int(input('Digite o primeiro termo da progressao aritmetica: ')) razao = int(input('Digite a razao da progressao aritmetica: ')) i = 0 while i < 10: print('{} → '.format(primeiro + razao * i), end='') i += 1 print('Acabou')
3.859375
4
smollm
ee3c7491806c27537801ea70b0bd505a0203fdff
Serikaku/Treinamento-Python
/CursoemVideo/ex061.py
246
null
null
null
null
from math import hypot co = float(input('Digite o cateto oposto: ')) ca = float(input('Digite o cateto adjacente: ')) h = hypot(co, ca) print('Em um triangulo retangulo de catetos de tamanhos {} e {}, o comprimento da hipotenusa e {:.2f}'.format(co, ca, h))
3.84375
4
smollm
af6181a93b10c2e08bc417a7a130c4e7e2da6720
Serikaku/Treinamento-Python
/CursoemVideo/ex017.py
259
null
null
null
null
import math grau = float(input('Digite um angulo: ')) ang = math.radians(grau) seno = math.sin(ang) cosseno = math.cos(ang) tangente = math.tan(ang) print('O angulo {} possui seno {:.2f}, cosseno {:.2f} e tangente {:.2f}'.format(grau, seno, cosseno, tangente))
3.6875
4
smollm
23881fe483b7e0e50047516bf4581a1ca01f503b
Serikaku/Treinamento-Python
/CursoemVideo/ex018.py
260
null
null
null
null
from math import trunc x = float(input('Digite um numero: ')) print('O numero {} tem a parte inteira {}'.format(x, trunc(x))) #print('O numero {} tem a parte inteira {:.0f}'.format(x, x//1))
4.03125
4
smollm
4491360e03bf3519d4dbc127605735a53b2861a1
Serikaku/Treinamento-Python
/CursoemVideo/ex016.py
192
null
null
null
null
x = int(input('Digite um valor: ')) print('{}! = '.format(x), end='') fatorial = 1 while x != 1: print(x, end=' x ') fatorial *= x x -= 1 print("1 = {}".format(fatorial))
4.03125
4
smollm
4dd1b92de67427c8648204574a442e2bd03b85de
Serikaku/Treinamento-Python
/CursoemVideo/ex060.py
184
null
null
null
null
boletim = [] linha = '-'*22 while True: nome = str(input('Nome: ')) nota1 = float(input('Nota 1: ')) nota2 = float(input('Nota 2: ')) media = (nota1 + nota2) / 2 boletim.append([nome, [nota1, nota2], media]) cont = str(input('Deseja continuar? [S/N] ')) if cont in 'Nn': break print(...
3.640625
4
smollm
e0075d714c42a437483bfcd228fc36b5d261d3ef
Serikaku/Treinamento-Python
/CursoemVideo/ex089.py
675
null
null
null
null
from datetime import date ano = int(input('Digite o ano de nascimento do atleta: ')) idade = date.today().year - ano print('Categoria: ') if idade <= 9: print('Mirim') elif idade <= 14: print('Infantil') elif idade <= 19: print('Junior') elif idade <= 25: print('Senior') else: print('Master')
4.125
4
smollm
cb1e8ffa0d0787fbf950c0eb0351a8eb67ea675b
Serikaku/Treinamento-Python
/CursoemVideo/ex041.py
315
null
null
null
null
x = float(input('Digite a velocidade de um carro: ')) if x > 80: print('Voce foi multado em R${:.2f}'.format((x-80)*7))
3.828125
4
smollm
959d5927916bd18ffabf33a1903e6ebcd32934d3
Serikaku/Treinamento-Python
/CursoemVideo/ex029.py
125
null
null
null
null
def area(x, y): area = x * y print(f'A area de um terreno{x:.1f}x{y:.1f} e de {area:.1f}m²') print(' Controle de Terrenos') print('-' * 20) largura = float(input('Largura (m): ')) comprimento = float(input('Comprimento (m): ')) area(largura, comprimento)
3.734375
4
smollm
e00fd0b92e735862f216111c3ba4a510ace661e1
Serikaku/Treinamento-Python
/CursoemVideo/ex096.py
267
null
null
null
null
n = int(input('Digite um numero inteiro: ')) print('Sucessor: {}. Antecessor: {}'.format(n+1, n-1))
4
4
smollm
f74ada647e1e3d63f2c9251cff9f502884ea262f
Serikaku/Treinamento-Python
/CursoemVideo/ex005.py
99
null
null
null
null
#Algorithm 1 # number = range(1, 101) # print(number) #convert i to string # for i in range(1, 101): # if i % 3 == 0: # number += "Fizz" # elif i % 5 == 0: # number += "Buzz" # elif i % 3 and i % 5 == 0: # number += "FizzBuzz" # else: # print(i) for i in ra...
3.8125
4
smollm
4ff86e20a5ee1ea5a2738c1a3c3a806e426f5749
namaslay33/digitalCrafts
/python-exercises/W1/Fri/Algorithm.py
1,024
null
null
null
null
#CS Project: Huffman codes. This project will focus on the process of #creating and using Huffman codes. Review the lecture notes related #to Huffman codes and fixed length codes. Do not modify the two helper #functions that bave been provided. #helper function 0: this function creates a file which we can use to #...
3.84375
4
smollm
9b58c8e6bf913273c60de437d885c96d42428563
hboonewilson/IntroCS
/BooneWilsonFinalProject.py
8,601
null
null
null
null
#Boone Wilson #Discussion Assignment 10 #Section A04 #Nov 14 def getHawkID(): return ['hbwilson'] #Write function that takes as an argument a list of pos inegers and a target #value,and returns the number of times that the target value appears in the list #call this funtion problem 1 def problem1(myList, targ...
3.84375
4
smollm
254b1e6215f106a9a03bdfe6d22a92ed3c61adc7
hboonewilson/IntroCS
/DAs/WilsonBooneDA10.py
2,869
null
null
null
null
#whileloop function that iterates the number of times you tell it in the #argument (n) adding a specific number or character (ch) into myList def whileList(n): #myList: record ch appendings myList = [] #keep track of iteratinons counter = 0 while len(myList) < n: #while the length of myList...
4.15625
4
smollm
c3cc5a57232e811a47bc811e467be6a1d2c319ab
hboonewilson/IntroCS
/Programming_practice.py
581
null
null
null
null
def getHawkID(): return ['hbwilson'] #return the sum of all numbers in odd indexes def getSumOdds(aList): #create variable to add to called add add = 0 #iterate for indexes for i in range(0, len(aList)): #if index is odd if i % 2 != 0: #add to add variable ad...
3.578125
4
smollm
adb7e7b8fcb3c1bd69d7f5d47c2fc261b6dc64de
hboonewilson/IntroCS
/DAs/WilsonHenryDA5.py
1,899
null
null
null
null
""" Basics of a friendly syntax frontend. """ ## example = open('examples/zebra.pytho').read() ## program = parse(example) ## sorted(program.keys()) #. ['Append', 'Left_and_middle', 'Left_of', 'Main', 'Member', 'Next_to', 'Zebra'] ## program.q('Member q []') ## program.q('Member x (Cons 5 [])') #. x: 5 ## program.q('M...
3.515625
4
smollm
7b2839981fb4d6af0d1d32e908a73eb783439c16
tizianorosato/pythological
/parser.py
7,789
null
null
null
null
#Importing libs import sys, pygame print(pygame.__version__) import random #We need to init PYGAME every time we use it pygame.init() #some default colors in RGB format (RED,GREEN,BLUE) red = (255,0,0) green = (0,255,0) blue = (0,0,255) darkBlue = (0,0,128) white = (255,255,255) black = (0,0,0) col = (123,2,34) pi...
3.90625
4
smollm
b91d5e6bd3026d2c40e372fe3db94667d0380706
VenerAndrei/PythonCourse
/FlappyBird/Day_2/main.py
3,665
null
null
null
null
def main(): new_file = open("encryption.txt", "r") newset = set() for line in new_file: word = line.split() newset.update(word) print(newset) new_file.close() main()
3.515625
4
smollm
79c64baa71cfaffccbd59aa06b81e7a4ddc0f05c
ScottSko/Python---Pearson---Third-Edition---Chapter-9
/Chapter 9 - Programming Exercises #4 - Unique Words.py
227
null
null
null
null
# Problem 6 # # Assume you have two matrices A and B in a sparse matrix format (5x5), # where each record is of the form i, j, value. # Design a MapReduce algorithm to compute the matrix multiplication A x B import MapReduce import sys mr = MapReduce.MapReduce() def mapper(record): matrix = record[0] i ...
3.578125
4
smollm
f6924d557f8152df91dcaf6f0fab8ccb371fa359
xmmmmd/datascience_coursera
/assignment3/multiply.py
1,473
null
null
null
null
#!usr/bin/python3 import sqlite3 class RecordDataBaseManager(): ''' handles initializing database and its modification and query of data ''' def __init__ (self): ''' loads the files and creates table if its first time ''' self.__conn = sqlite3.connect("record.db"); self.__cur = self.__conn.cursor(); #if it...
3.875
4
smollm
56101b2e9de928c44d16f522ed2b8f0a23f003bf
Sabin-Gurung/RecordVisualizer
/DataBaseManager.py
2,243
null
null
null
null
""" Given a time in -hour AM/PM format, convert it to military (-hour) time. Note: Midnight is on a -hour clock, and on a -hour clock. Noon is on a -hour clock, and on a -hour clock. Input Format A single string containing a time in -hour clock format (i.e.: or ), where and . Output Format Convert and print the gi...
4.28125
4
smollm
4151101bd90d3394053232de2113c9d64690ea9b
ramo16/algorithms
/Time Conversion.py
727
null
null
null
null
import random from os import system def clear(): system("clear") # system("cls") # for windows user def randomWord(): f = open("words.txt", 'r') word = random.choice(f.readlines()).lower() f.close() return word def playAgain(): run = True while run: playAgain = input("Do y...
3.859375
4
smollm
58bce2cebac71e4bfa120078d708185fadef311b
ClosedClass/Python-Project
/02 Hangman Game/main.py
4,029
null
null
null
null
import sys import time import pandas as pd import numpy as np def get_filters(): """ Asks user to specify a city, month, and day to analyze. Returns: (str) city - name of the city to analyze (str) month - name of the month to filter by, or "all" to apply no month filter (str) day ...
4.4375
4
smollm
5f6a1ac5f52d08e2d07592bdf45678060885159a
pockywocky/pdsnd_github
/bikeshare_refactor.py
7,629
null
null
null
null
# Brief: Simulation of Lotka–Volterra equations (aka predator–prey equations) #---------------------------------------------------------------------------------- import matplotlib.pyplot as plt # Growth of a rabbit population def rabbitGrowth(): capacity = 50 # Capacity (max Population) velocity = 0.5 # Ra...
4.1875
4
smollm
50a48409a04f52b8d503df24205d01451ab6584a
UF-Elektron/HelloWorld
/ETH_Aufgaben/lotkaVolterra.py
1,850
null
null
null
null
class TicTacToeBoard: # Constructor for a TicTacToeBoard object def __init__(self, computer, human): self.board = ['N' for i in range(9)] # Initialize a board to all 'N' self.length = len(self.board) # The length (number of squares) on a board self.empties = [0, 1, 2, 3, 4, 5, 6, ...
4.09375
4
smollm
286452d3e782ad15f0430b51e62319350ab56b97
mosqutip/EECS348
/TicTacToe/TicTacToe.py
7,823
null
null
null
null
def isValid(s): char_dict = {} for char in s: if char in char_dict: char_dict[char] += 1 else: char_dict[char] = 1 minimum_count = char_dict[char] maximum_count = char_dict[char] count_dict = {} for char, value in char_dict.items(): if value in c...
3.5625
4
smollm
ef633a7df53499f1061e5af10e20af6841ee31fe
salma-nyagaka/golclinics-dsa
/classwork/01-arrays-and-strings/sherlock_and_valid_string.py
849
null
null
null
null
import spacy # Load the large English NLP model naturalLanguageProcessor = spacy.load('en_core_web_lg') # The text we want to examine text = """London is the capital and most populous city of England and the United Kingdom. Standing on the River Thames in the south east of the island of Great Britain, London has b...
3.96875
4
smollm
4759f9dd18b91835cf00d9d049e5116cefe18fcf
douglasbrandao21/natural-language-processing
/named_entity_recognition.py
1,956
null
null
null
null
# Mastermind board game: to find combination of 4 colors (allowing duplicates) of 8. # 8 ^ 4 = 4096 possible combinations # code applies algorithm suggested by Donald Knuth import re from itertools import product allcolors = ['black', 'blue', 'brown', 'green', 'orange', 'red', 'white', 'yellow'] # make a list of ...
3.65625
4
smollm
cbbc6d27390143ce138bb60043896011a266aa21
artmv/mastermind
/mastermind.py
2,583
null
null
null
null
def main(): normal_sedan = CarFactory.make_sedan(200, 200, 'red') HD_sedan = HDCarFactory.make_sedan(200, 200, 'red') print(normal_sedan.emblem) print(HD_sedan.emblem) class CarFactory: @classmethod def make_sedan(cls, width: int, height: int, color: str,): return cls.Sedan(width, h...
3.546875
4
smollm
2d5fa93226416cd98df6ca37946a89f29137a3b9
HongrimRyu/practiceinpython
/abstract_factory.py
1,525
null
null
null
null
""" 1. Skriv en funktion som "vänder" en textsträng baklänges - utan att använda "reverse" (eller [::-1])! Använd istället strängar eller listor, och en for-loop. T.ex. "12345" blir "54321". 2. Skriv en funktion som tar in en textsträng, och returnerar antalet stora bokstäver i strängen. 3. Skriv en funktion som avgö...
3.953125
4
smollm
55d47df446ea49199ed511fefe6864e469dafb13
objarni/kyh-practice
/vecka_5_uppg_38till46/uppgift40.py
805
null
null
null
null
import random maxnum = 100 a_random_int = random.randint(1, maxnum) print(f"Jag tänker på ett tal mellan 1 och {maxnum}. Gissa vilket!") def mainloop(): guess_count = 0 while True: guessed_number = ask_number() guess_count += 1 if guessed_number == a_random_int: print("...
3.671875
4
smollm
644060e656b90d6e5f91b5dfac0e877b7859afea
objarni/kyh-practice
/vecka_1_uppg1till11/uppgift5.py
865
null
null
null
null
# 15.3 Göteborgsvarvet, vilken placering kom XYZ på? Implementera resten av detta program: # runners_in_order = “Lisa Lasse Louise Leopold Lova Love Lennart Lena Lisette Linus”.split() # vem = input(“Ange löpare du söker placering för”) runners_in_order = "Lisa Lasse Louise Leopold Lova Love Lennart Lena Lis...
3.71875
4
smollm
ad8fe3b529fa8d309d0f6fea6f1a6dfe175fa4f7
objarni/kyh-practice
/vecka_2_uppg_12till19/uppgift15_3.py
691
null
null
null
null
''' Träna slicing av strängar och listor! Reg.nr på bilar i Sverge skrivs traditionellt* med tre bokstäver och tre siffror. 1. Bygg ett program som låter användaren mata in ett reg.nr och skriv ut de två grupperna var för sig; använd slicing-syntax för att dela upp inputsträngen. Ex. Ange regnr: ABC663 Bokstävsgrup...
4.1875
4
smollm
70e910256a9944d83d05e42ef4d3c499f8d0ec01
objarni/kyh-practice
/vecka_4_uppgift_29till37/uppgift30_2.py
1,330
null
null
null
null
def solution(game_board, table): def find_empty_space(r, c, space): board_visited[r][c] = True space.append((r, c)) for i in range(4): tr = r + dx[i] tc = c + dy[i] if 0 <= tr < ROW and 0 <= tc < COL and game_board[tr][tc] == 0 and not board_visited[tr][tc...
3.53125
4
smollm
4edd00e5359ecf1ddf17d4109992b29380f895b5
zooo1/algorithm
/programmers/weekly/3.py
1,604
null
null
null
null
# some predifined vars usernamelist = [] usernamechecklist = [] passwordlist = [] ctrllist = [] specharcontroller = "200" spacecontroller = "100" specharlist = ["!", "@", "#", "$", "%", "&", "_"] # main while loop, never ends while 1: ctrl = input("What Do You Want To Do : LOGIN or SIGNUP\n").lower() # signup c...
3.875
4
smollm
16e35a98f99f52a9d75ac13b4848c8f91efa3277
rohyunjeong/file-io-python
/main.py
5,667
null
null
null
null
def flatten(container): """Flattens an array or dict Args: container: multi dimensional array of arbitrary nest level Returns: A 1D list """ for i in container: if isinstance(i, (list,tuple)): for j in flatten(i): yield j else: ...
4.125
4
smollm
d2c908bf6279a8c84336fa88ead771d0fd91c3a5
TomButts/Lichen-Project
/feature-extraction/extractors/image-processing/flatten.py
331
null
null
null
null
import turtle import math N = int(input("Numero de triangulos - ")) def triangulo(n): if n==1: for target_list in range(3): turtle.forward(int(50)) turtle.left(120) else: for facePolígono in range(n): algulo1 = 360/n angulo2E3 = algulo1/2 ...
3.890625
4
smollm
2fea3ce15fc367f8fc67dc58200a66894c35277b
HenriqueSamii/TP1-Fundamentos-de-Programa-o-com-Python
/numrosParalelosFun.py
1,399
null
null
null
null
#12. Faça uma função no Python que, utilizando a ferramenta turtle, desenhe um círculo de raio N. import turtle def circulo(n): for target_list in range(360): turtle.forward(int(n)) turtle.left(1) x = input("Tamanho do círculo - ") circulo(x)
4.46875
4
smollm
3bcf82437ceea83fc8d8c85b34b03c6b5f1224a5
HenriqueSamii/TP1-Fundamentos-de-Programa-o-com-Python
/tp1IntroPiton12.py
277
null
null
null
null
#3. Escreva uma função em Python que calcule o fatorial de um dado número N usando um for. #O fatorial de N=0 é um. O fatorial de N é (para N > 0): N x (N-1) x (N-2) x … x 3 x 2 x 1. #Por exemplo, para N=5 o fatorial é: 5 x 4 x 3 x 2 x 1 = 120. #Se N for negativo, exiba uma mensagem indicando que não é possível calcula...
4
4
smollm
e1cf6e25b9c3c5ec1accb0411b046c405daf159d
HenriqueSamii/TP1-Fundamentos-de-Programa-o-com-Python
/tp1IntroPiton3.py
651
null
null
null
null
""" Ejercicio 2 Algoritmo que pida un número y diga si es positivo, negativo o 0. """ numero = float(input('ingrese valor: ')) if numero > 0: print('el numero es positivo') elif 0 > numero: print('el numero es negativo') else: print('el numero es igual a cero')
4.0625
4
smollm
7b4b6faa35d94573c3852d82d93cb3c9edca1c37
durbonca/python-basic-exercises
/Ejercicios para estructura if/2.py
276
null
null
null
null
#PCC Assignment 5 boy_scores = [] girl_scores = [] def compareBoyAndGirl(boy, score): if boy: boy_scores.append(int(score)) else: girl_scores.append(int(score)) def average(input_list): total = 0 for i in input_list: total += int(i) return total / len(input_list) prompt = 'Boy (b), Girl (g), quit(q)' whi...
3.921875
4
smollm
b143378fea7c98c17e5389c717cf241ca274743c
AWOLASAP/compSciPrinciples
/python files/assignment5.py
665
null
null
null
null
def isValidDate(someDate): #check if date is valid num = isValueNumber(someDate) if someDate and len(someDate)>=8 and num: return True else: return False def isValidZip(someZip): #check if zipcode is valid num = isValueNumber(someZip) if someZip and len(someZip)>=5 and n...
3.53125
4
smollm
9c434edefc838dbee818a370cc1bef8241a8f02c
wpena1/FindPoliticalDonors
/src/main.py
4,253
null
null
null
null
#assign 10 to types_of_people types_of_people = 10 # asign thef-string to x (insert types_of_people in the string ) x= f"there are {types_of_people }types of people" binary ="binary" do_not = "don't" y = f"Those who know {binary} and those who {do_not}." # print(">>>>>>>after assign y") print(x) # print(">>>...
4.28125
4
smollm
04897c05c8fc0b15355918350f4a934f15e8290b
ambikeshkumarsingh/LPTHW_ambikesh
/ex6.py
481
null
null
null
null
states ={ 'Oregon' :'OR', 'Florida' :'FL' , 'California' : 'CA' , 'New York' :'NY', 'Michigan' :'MI' } cities ={ 'CA' : 'San fransisco', 'MI' : 'Detroit' , 'FL' : 'Jacksonville' } cities['NY'] = 'New York' cities['OR']='Portland' print('_._.' *10) print("NY states has :" ,cities['NY']) print("OR s...
3.8125
4
smollm
f368f72b8a8c72efc673301b4df372175f1bd7a1
ambikeshkumarsingh/LPTHW_ambikesh
/ex39.py
496
null
null
null
null
# Keep revisiting this exercise... class Song(object): def __init__(self, lyrics): self.lyrics =lyrics #what this line is doing?? def sing_me_a_parody(self): for line in self.lyrics: print(line) happy_bday = Song(["Happy Birthday to you", "I don't w...
3.953125
4
smollm
639138ef857ff4f18b38528e299baa275449fe5a
ambikeshkumarsingh/LPTHW_ambikesh
/ex40.py
422
null
null
null
null
# Autores: Mercedes Miranda # El nombre de tu amigo # Fecha; 9 de septiembre de 2019 # Metodo Newton Raphson import sympy as sym #se define la funcipon para desarrollar el metodo #funcion es la función en terminos de sympy, trataré de agregar un apendice #de funciones posibles que se pueden agregar #x0 es el...
4.15625
4
smollm
74e9f8bb00f009a51ec420bfb6058a1f43ca180b
AbeJLazaro/MetodosNumericos
/newton.py
1,124
null
null
null
null
#find highest value in the list and use index to assign highest = 0 index = 0 for crime in crime_rates: if crime > highest: highest = crime index = crime print(crime_rates) print(highest)
4.125
4
smollm
8a7abc1a908d1b696a847b93faf139295ac69fdb
BDasha/python_notes
/bool.py
212
null
null
null
null
class StringCalculator: def add(self, user_input: str) -> int: if user_input is None or user_input.strip() == '': return 0 else: numbers = user_input.split(',') result = 0 for number in numbers: if number.isdigit: ...
3.953125
4
smollm
16e9195f5ca4648ab9aba0748a6fd77fd49a8811
bartoszkobylinski/tests
/app/string_calc.py
519
null
null
null
null
import turtle turtle.pencolor("black") turtle.pensize(3) turtle.penup() turtle.goto(-150, 100) turtle.pendown() # 正方形 turtle.forward(300) turtle.right(90) turtle.forward(300) turtle.right(90) turtle.forward(300) turtle.right(90) turtle.forward(300) # 圆形-左眼 turtle.pencolor("red") turtle.penup() turtle.goto(-90, 50) t...
3.65625
4
smollm
fc4479795299dddf62cafb0557e5c8451e4d82f3
minrat/AI
/TMP_01.py
861
null
null
null
null
# 主题: 99乘法 # 复习:% {}.format() 显示 # 注意{},不带序号的时候,前后按照顺序自动匹配 # 注意{}的前后格式:带序号注意不要超过范围(从0开始),不写序号,自动前后按序一一匹配 # method-01 for i in range(1, 10): for j in range(1, i): print("{}x{}={}\t".format(i, j, i*j), end='') print() # method-02 abc = [1, 2, 3, 4, 5, 6, 7, 8, 9] for i in abc: j = 1 while j...
3.71875
4
smollm
91d2d670a31afc7a44021c40e69b092153e0f3bb
minrat/AI
/stage1/99.py
761
null
null
null
null
from tkinter import * import os class Calculator: def __init__(self): self.root = Tk() # 设置标题 self.root.title("XP计算器") # 设置计算器窗体大小 self.root.geometry("300x200") # 设置窗体不能改变大小 self.root.resizable(width=False, height=False) # 设置图标 self.root.iconb...
3.5
4
smollm
9fc70732769b633dc6ab893ce4a47c71c97196f1
minrat/AI
/stage1/tkinter/cal_full_demo.py
5,305
null
null
null
null
import turtle turtle.pensize(1) turtle.pencolor("black") turtle.colormode(255) # turtle.fillcolor(100, 100, 100) turtle.penup() count = 0 location = 120 color = 0 # # 填色设定 # turtle.fillcolor("red") # # 填色开始 # turtle.begin_fill() # turtle.goto(0, -100) # turtle.pendown() # turtle.circle(100, 360) # # 填色结束 # turtle.en...
3.71875
4
smollm
4b8f11455f057fbbc139655f792685945223fbb8
minrat/AI
/stage1/turtle/bangbangtang.py
1,320
null
null
null
null
class Vector: def __init__(self, data): self.data = data def __str__(self): return f"({','.join([str(i) for i in self.data])})" def add(self, vector): if len(self.data) != len(vector.data): raise ValueError return Vector([self.data[i] + vector.data[i] for i in r...
3.71875
4
smollm
27b7212dbb9a0e91f97df8735c7c803fa3f9cb68
slamatik/codewars
/5 kyu/Vector class 5 kyu.py
910
null
null
null
null
from string import ascii_uppercase class CaesarCipher(object): def __init__(self, shift): self.shift = shift self.shift_data = ascii_uppercase[self.shift:] + ascii_uppercase[:self.shift] def encode(self, st): st = st.upper() data = str.maketrans(ascii_uppercase, self.shift_dat...
3.703125
4
smollm
0b31a5bdfc1fd349eeeb1dd539c58c062674ffce
slamatik/codewars
/5 kyu/Ceaser Cipher Helper 5 kyu.py
583
null
null
null
null
def find_even_index(arr): for i in range(len(arr)): if i == 0: left = 0 right = sum(arr[i + 1:]) else: left = sum(arr[:i]) right = sum(arr[i + 1:]) if left == right: return i return -1 print(find_even_index([1, 2, 3, 4, 3, 2, ...
3.9375
4
smollm
e13da84b514fb8b4c746281012b02864c9993a93
slamatik/codewars
/6 kyu/Equal Sides of An Array 6 kyu.py
523
null
null
null
null
class Warrior: list_of_ranks = ["Pushover", "Novice", "Fighter", "Warrior", "Veteran", "Sage", "Elite", "Conqueror", "Champion", "Master", "Greatest"] def __init__(self): self.level = 1 self.experience = 100 self.rank = self.list_of_ranks[0] self.achievement...
3.6875
4
smollm
be990fa6036011660fb4d62db1e95845ee48e096
slamatik/codewars
/4 kyu/The Greatest Warrior.py
2,146
null
null
null
null
def permutations(string): a = list(string) n = len(string) solution = [] def permute(a, l, r): if l == r: solution.append("".join(a)) else: for i in range(l, r + 1): a[i], a[l] = a[l], a[i] permute(a, l + 1, r) a[i]...
3.859375
4
smollm
2523a8de7ebc7cd48118c4a5f6cd221411fe8ded
slamatik/codewars
/4 kyu/Permutations 4 kyu.py
483
null
null
null
null
data = [{'name': 'Bart'}, {'name': 'Lisa'}, {'name': 'Maggie'}, {'name': 'Homer'}, {'name': 'Marge'}] def namelist(names): string = "" if len(names) == 0: return string elif len(names) == 1: string += names[0]["name"] elif len(names) == 2: string...
3.921875
4
smollm
1257607d3d204fb2ac0018cd079b82068b84ec36
slamatik/codewars
/6 kyu/Format a string of names like 'Bart, Lisa & Maggie' 6 kyu.py
570
null
null
null
null
class DefaultList: def __init__(self, array, default): self.array = array self.default = default def check(self, value): if value < -len(self.array) or value >= len(self.array): return False else: return True def extend(self, values): self.ar...
3.65625
4
smollm
3705e00ab21e7b6e3fad2da302f8437d3dcdbe6f
slamatik/codewars
/6 kyu/DefaultList 6 kyu.py
1,186
null
null
null
null
def create_phone_number(n): n = [str(i) for i in n] return f"({''.join(n[:3])}) {''.join(n[3:6])}-{''.join(n[6:])}" print(create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]))
3.53125
4
smollm
aebdf33d5e0889a2916e6b4d812455fc38c2f3c5
slamatik/codewars
/6 kyu/Create Phone Number 6 kyu.py
185
null
null
null
null
def get_pins(observed): data = {"1": ["1", "2", "4"], "2": ["1", "2", "3", "5"], "3": ["2", "3", "6"], "4": ["1", "4", "5", "7"], "5": ["2", "4", "5", "6", "8"], "6": ["3", "5", "6", "9"], "7": ["4", "7", "8"], "8": ["5", "7", "8", ...
3.546875
4
smollm
3974a264b1d8d106031e27d5b0b1a79441217700
slamatik/codewars
/4 kyu/The observed PIN.py
768
null
null
null
null
# !/usr/bin/env python # !-*-coding:utf-8 -*- # !@Author : fanchg # !@Time : 2018/9/19 import unittest class Solution: def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ dp = nums dp[0] = nums[0] max_val = dp[0] for i in range(1,...
3.578125
4
smollm
14caf6449f65306fc5e4937f1a61f6c21e1a25c1
fanchunguang/python
/dynamic.py
3,358
null
null
null
null
# !/usr/bin/env python # !-*-coding:utf-8 -*- # !@Author : fanchg # !@Time : 2018/7/11 import unittest from queue import PriorityQueue import heapq class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution: def findKthLargest(self, nums, k): """ ...
3.875
4
smollm
0ad3f9421ef73d495956ff11c2c4e5ba72060259
fanchunguang/python
/linked-list.py
4,626
null
null
null
null
#String Manupulation print("5" + "5"); print("This costs " + str(6) + " dollars"); print("This costs " + str(5+7) + " dollars"); print("Hello:Nick".split(":")); print("Hello:Nick:World".split(":")); print("My name is " + "Kalp:Hello:World".split(":")[0]); print("There are " + "24:16:4".split(":")[0] + " hours in a day...
4.15625
4
smollm
76c61a49d819427101af1fe30b6cfd6c38194197
Code4X/Calculator
/Sample.py
4,064
null
null
null
null
# Hangman game ! import random # importing word files from ISProject.Hangman_with_GUI_and_Difficulties.EasyWords import easy_list from ISProject.Hangman_with_GUI_and_Difficulties.NormalWords import normal_list from ISProject.Hangman_with_GUI_and_Difficulties.HardWords import hard_list # imports all of the words fro...
3.890625
4
smollm
1b62ba46c3c90f0efb9114b5a132cfadc0695946
ksu-is/Hangman_with_GUI_and_Difficulties
/NOGUIProjectGrahmJones.py
5,136
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 reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]: if left == right: return...
4.09375
4
smollm
3546251f6c30d38ce1185f2a3e9f9a247ea0b153
gany-c/DataStructures
/src/lists/reverse_linked_list.py
2,080
null
null
null
null
#!/usr/bin/python3 """A simple file server client This code is based on the example TCP client given in the Python docs: https://docs.python.org/3.6/library/socketserver.html#module-socketserver """ import argparse import socket import sys import logging from pathlib import Path # Provided example file hardcoded P...
3.703125
4
smollm
b7a56114f9a263c17140bcfe0b15fd2d4c50c091
samuelchodur/file_server_and_client
/client-folder/socketserver_client-0.3.py
7,550
null
null
null
null
class Potato: def __init__(self): self.info = "刚取出的土豆" self.lever = 0 self.list1 = [] def cook(self,a): self.lever += a if self.lever >= 10: self.info = "炒糊了" elif self.lever >=8: self.info = "火大了" elif self.lever == 6: self.info = "可口的土豆丝" elif self.lever >=4 : self.info = "僵硬的土豆丝" else...
3.71875
4
smollm
eff5b6d63bbd8e2a429903da6a40752ccef16407
saotian/p1804
/eryueyizhou/tudousi.py
806
null
null
null
null
class People1(object): def __init__(self): self.__money = 0 @property def money(self): return self.__money @money.setter def money(self,value): self.__money = value # money = property(get_money,set_money) p = People1() print(p.money) #p.money = 99111 #print(p.money)
3.78125
4
smollm
e67e83d2c7b6979808317634bcea000914cfd085
saotian/p1804
/eryueyizhou/_fangfa.py
279
null
null
null
null
class car: def __init__(self,gasolina): self.gasolina = gasolina def arrancar(self): if self.gasolina > 0: print('Arrancar') else: print('Não liga') def conduzir(self): if self.gasolina > 0: self.gasolina -= 1 print('Menos %i litros de gasolina' %(se...
3.71875
4
smollm
25f9e9656ec6cca8d4e4454dcc84c31e03891e9f
robertocrw/python
/car-oop.py
574
null
null
null
null
#!/usr/bin/python3 weekdays = ['mon','tues','wed','thurs','fri'] days = weekdays[0] # elemento 0 days = weekdays[0:3] # elementos 0, 1, 2 days = weekdays[:3] # elementos 0, 1, 2 days = weekdays[-1] # ultimo elemento test = weekdays[3:] # elementos 3, 4 days = weekdays[-2] #...
4.34375
4
smollm
d7d8ab410a212c5de35d849ac215cb48bd16ef37
wzoreck/intro_python_Daniel-Wzoreck
/lista-102.py
2,374
null
null
null
null
class Books(object): def __init__(self,books): self.book={} self.books=books def create_book(self,book_id,bookname,author,category,quantity,publication_year): self.bookname=bookname self.author=author self.id=book_id self.category=author self.qu...
3.71875
4
smollm
10020ad18a4c1d9ec8dbd03a4803ab6b0c64f213
kiamakelvinsmalls/hellobooksapi
/model.py
1,825
null
null
null
null
import unittest from city_functions import get_city_country class CityCountryTest(unittest.TestCase): def test1(self): formatted_city_country = get_city_country('santiago', 'chile') self.assertEqual(formatted_city_country, 'Santiago,Chile') def test2(self): formatted_city_country = get...
3.59375
4
smollm
f02a0657a1724a4f33be1c6534ac7ddc4c1ac9a3
ArtBelgorod/book
/Chapter_11.py
516
null
null
null
null
# Ex 9.13 - 9.16 # 9.13 from random import randint, choice class Die: def __init__(self, cub_sides=6): self.sides = cub_sides def roll_die(self): print(randint(1, self.sides)) my_die = Die() for i in range(10): print(f"Бросок - {i + 1} - ", end="") my_die.roll_die() print("---------...
3.515625
4
smollm
83073e40c47381a6c4cde920584c33a9ad15d6ba
ArtBelgorod/book
/cub.py
1,079
null
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 7 11:03:45 2019 @author: jean """ import numpy as np import matplotlib.pyplot as plt def step(sum): if (sum >= 1): return 1 return 0 #Problemas de classificação binária def sigmoide(sum): return 1/(1 + np.exp(-sum)) #Classif...
3.796875
4
smollm
2a6ab11c8ee9485c42006b4ec062a814ee92a755
jeanmmlima/deep-learning
/activate_functions.py
1,299
null
null
null
null
# -*- coding: utf-8 -*- print "How old are you?", age = raw_input() ''' age = 10 print "So , you're %d old." % age ''' print "How tall are you?", height = raw_input() print "How much do you weigh?", weight = raw_input() print "So , you're %s old, %s tall and %r heavy." %( age, height, weight)
3.796875
4
smollm
d7c35f411ed74848cd61a52dd5ceba322868d0d7
yb170442627/YangBo
/Python_ex/ex11.py
301
null
null
null
null
#before starting the code we entered the following: #pip install matplotlib #pip install --user --upgrade matplotlib #pip install pandas #pip install pandas-datareader #pip install numpy #pip install datetime from pandas_datareader import data from pandas_datareader._utils import RemoteDataError #for graphs import matp...
3.8125
4
smollm
da637aa99d2cf7a46780bf1b7fdf7624787189ad
coletteko/HSG-Python-Project-FS2019
/SMI Stock Analysis_Python_ColetteKoch CarlaGreter.py
11,733
null
null
null
null
def split_and_join(line): # write your code here for word in line: line1 = line.split(" ") line2 = "-".join(line1) return(line2) #another way to do it def split_and_join(line): # write your code here line = line.split(" ") line = "-".join(line) l = "" for lett in lin...
4.0625
4
smollm
3580e8fcf9d7a4141961b1331d5e64caef9b4b37
Joanna-O-Ben/ADM-HW1
/Problem1/Strings/String Split and Join.py
454
null
null
null
null
#!/bin/python3 import math import os import random import re import sys # # Complete the 'superDigit' function below. # # The function is expected to return an INTEGER. # The function accepts following parameters: # 1. STRING n # 2. INTEGER k # def superDigit(n, k): # Write your code here m = n * k % 9 ...
3.953125
4
smollm
cd093b1df3ce174f68f1d9144c10fb9f3b60925a
Joanna-O-Ben/ADM-HW1
/Problem2/Recursive Digit Sum.py
662
null
null
null
null
# Enter your code here. Read input from STDIN. Print output to STDOUT import calendar if __name__ == '__main__': s = input() s = s.split(" ") month = int(s[0]) day = int(s[1]) year = int(s[2]) c = calendar.weekday(year, month, day) # print(c) if c == 0: print("MONDAY") el...
3.9375
4
smollm
afa5ec8802f49995cd6138edfbe03d18af43ab1e
Joanna-O-Ben/ADM-HW1
/Problem1/Date and Time/Calendar module.py
567
null
null
null
null
# Enter your code here. Read input from STDIN. Print output to STDOUT print(len((set(input().split()) if input() != '-1' else '')|(set(input().split()) if input() != '-1' else '')))
3.671875
4
smollm
d5419320bcebdff87734df1b4c3e5ba98caa16da
Joanna-O-Ben/ADM-HW1
/Problem1/Sets/Set .union() Operation.py
183
null
null
null
null
import random #A function do shuffle all the characters of a string def shuffle(string): tempList = list(string) random.shuffle(tempList) return ''.join(tempList) #Main program starts here uppercaseLetter1=chr(random.randint(65,90)) #Generate a random Uppercase letter (based on ASCII code) uppercaseLetter2=chr(...
4.125
4
smollm
a7c67ff86eec8ece664ff9f789a90972f4523519
Bilal05476/PythonPractice
/randomPass.py
1,184
null
null
null
null
class Point(object): def __init__(self,x,y): self.x = x self.y = y def __repr__(self): return "({},{})".format(self.x,self.y) class Solution: """ Andrew's monotone chain convex hull algorithm constructs the convex hull of a set of 2-dimensional points in O(nlogn) time. ...
4.0625
4
smollm
455624e500b7b407763ea1d6826565ee262e694c
yc0/py-mix
/587.py
7,404
null
null
null
null
import re line = "Cats dffd smarter than are dogs hello\n" matchObj = re.match(r'(.*) are (.*)', line, re.I) print(matchObj) if matchObj: print("matchObj.group() : ", matchObj.group()) print("matchObj.group(1) : ", matchObj.group(1)) print("matchObj.group(2) : ", matchObj.group(2)) else: print("No ma...
3.703125
4
smollm
4610fc4e54b25fe2c787abf50308cac900091015
itspratham/Python-tutorial
/Python_Contents/RegularExpression/Prog1.py
326
null
null
null
null
# Basic Arithmetic Operations # +, -, *, / a = 103 b = 20 c = a + b print("a={}, b={}, c={}".format(a, b, c)) c = b - a print("a={}, b={}, c={}".format(a, b, c)) c = a * b print("a={}, b={}, c={}".format(a, b, c)) c = a / b print(c) print("a={}, b={}, c={}".format(a, b, c)) c = a // b print(c) print("a={}, b={}, ...
3.890625
4
smollm
bb192ce6ae12007b01ded483660c23aa516e98ec
itspratham/Python-tutorial
/Python_Contents/Basic_Operations/Arithmentic_Operations.py
405
null
null
null
null
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def append(self, data): if self.head is None: self.head = Node(data) return new_node = Node(data) cur_node...
3.984375
4
smollm
ecfae26ae677ed81587aa3253eae9c69243e0cab
itspratham/Python-tutorial
/Python_Contents/APAS/add_two_numbers.py
2,919
null
null
null
null
def LeftRotate(array, position): for i in range(position): temp = array[0] for j in range(len(array) - 1): array[j] = array[j + 1] array[len(array) - 1] = temp return array def RightRotate(array, position): for i in range(0, position): # Stores the last element...
4
4
smollm
6aef033d2ca440a4fd6f76c672d451d581ee9e85
itspratham/Python-tutorial
/Python_Contents/data_structures/Array_Rotation/Rotation_of_array.py
3,438
null
null
null
null
k=6 for i in range(1,8): for j in range(i+k): print("#",end=" ") for f in range(1,i+1): print(f,end=" ") print(" ") k=k-2
3.953125
4
smollm
37b4c68d073a775e082d76b985ec36b0a11fe84e
itspratham/Python-tutorial
/Python_Contents/data_structures/Pattern_Programming/Pattern_numbers/patterns_of_codes/pattern5.py
158
null
null
null
null
from collections import defaultdict class Graph: def __init__(self, graph): self.graf = graph def bfs_traversal(self): visited_list = [] for item, listt in self.graf.items(): if item not in visited_list: visited_list.append(item) for itemm in li...
4.0625
4
smollm
f9e8583acc81eb8947f4c4081f3746e317e934f4
itspratham/Python-tutorial
/Python_Contents/final_450/graphs/bfs.py
632