blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
1615f999e29a69cc41c1d5ba6057efa2661a567c
NadHobeika/git-course-trial
/main.py
93
3.71875
4
print('Hello world!') print('Again hello world!') a = 5 b = 10 c = a + b c += 10 print(c)
4158ddec48858494fea09623a6b935450fd87f4b
afatihirkli/data_science_practice
/physics-class.py
1,139
4.15625
4
# Codecademy Data Science Python Exercise : Getting Ready for Physics Class # train_mass = 22680 train_acceleration = 10 train_distance = 100 impact_mass = 1 ## Q1 ## def f_to_c(f_temp): c_temp = (f_temp - 32) * 5 / 9 return c_temp ## Q2 ## f100_in_celsius = f_to_c(100) print(f100_in_celsius) ## Q3 ## def c_to_f...
f2c5aaa9da6efbabe900a41120c38bee329dd489
CarolineSantosAlves/Exercicios-Python
/Exercícios/ex35AnalisandoTriangulo.py
279
4
4
print('-='*20) r1 = float(input('Reta 1: ')) r2 = float(input('Reta 2: ')) r3 = float(input('Reta 3: ')) if r1 < (r2 + r3) and r2 < r3 + r1 and r3 < r2 + r1: print('é possivel formar um triangulo') else: print('Não é possivel formar um triangulo com essas medidas')
542707309b405db89ac57745c0fe4d46901b88e7
CarolineSantosAlves/Exercicios-Python
/Exercícios/ex41ClassificandoAtletas.py
396
3.890625
4
from datetime import date ano = int(input('Digite seu ano de Nascimento: ')) idade = date.today().year - ano if idade <= 9: print('Categoria: \033[1;36m MIRIM') elif idade <= 14: print('Categoria: \033[1;36m INFANTIL') elif idade <= 19: print('Categoria: \033[1;36m JUNIOR') elif idade <= 25: print('Cate...
5baa233ce4a1d9efafe1f9f8f6a5f97b8d944c36
CarolineSantosAlves/Exercicios-Python
/Exercícios/ex093CadastroJogadorFutebol.py
645
3.546875
4
jogador = {} golp = [] jogador['nome'] = str(input('Nome do Jogador: ')) jogador['partida'] = int(input(f'Quantas partidas {jogador["nome"]} jogou? ')) for j in range(jogador['partida']): golp.append(int(input(f' Quantos gols na partida {j}? '))) jogador['golpartida'] = golp[:] jogador['total'] = sum(golp) prin...
fd4ff1d4fda5f5311c668e4ef0382244788aa212
CarolineSantosAlves/Exercicios-Python
/Exercícios/ex008ConversorMedidas.py
159
3.609375
4
medida = float(input('Digite a medida: ')) c = medida * 100 m = medida * 1000 print('medida {} \n{:.0f} centimetros \n{:.0f} milimetros '.format(medida, c, m))
ec05b91eb31ba4745637601c16e1a3841ada21da
CarolineSantosAlves/Exercicios-Python
/Exercícios/ex007Media.py
221
3.796875
4
aluno = input('Nome do Aluno: ') nota1 = float(input('Digite a primeira nota: ')) nota2 = float(input('Digite a segunda nota: ')) media = (nota1 + nota2) / 2 print('A média do aluno {} foi {:.2f}'.format(aluno, media))
10c20d3c969ae6370b9feaf2274082d491e318bc
CarolineSantosAlves/Exercicios-Python
/Exercícios/ex30ParImpar.py
146
4.03125
4
num = int(input('Digite um numero inteiro: ')) n = num % 2 if n == 0: print('O numero digitado é par!') else: print('O numero é impar')
68056fc9a17208016f72b42b498988fd937cc135
CarolineSantosAlves/Exercicios-Python
/Exercícios/ex010ConvertorMoeda.py
128
3.578125
4
d = float(input('Quantia em dinheiro: R$')) dolar = d / 3.27 print('A quantia de {:.2f} , vale {:.2f} dolares'.format(d, dolar))
bcc4496fecd72503e8953063636a695daa1e84d4
CarolineSantosAlves/Exercicios-Python
/Exercícios/ex085ListagemParImpar.py
344
3.84375
4
num = 0 valores = [[], []] for n in range(0, 7): num = int(input(f'Digite o {n + 1}º valor: ')) if num % 2 == 0: valores[0].append(num) else: valores[1].append(num) valores[0].sort() valores[1].sort() print(f'Os valores pares digitados foram {valores[0]}') print(f'Os valores impares digitado...
a97876466213e4d10e133369d428a6b9b212e58a
binoytv9/Think-Python-by-Allen-B-Downey--Exercises
/14th-chapter/6.py
587
3.5625
4
def antihtml(url): page=urllib.urlopen(url).read() antitag=re.sub(r'\s*<.*?>\s*','\n',page,flags=re.S) return antitag.split() def zip_code(): zipc=raw_input("\n\nenter the zip code : ") bname='http://www.uszip.com/zip' con = antihtml(os.path.join(bname,zipc.strip(string.punctuation+string.whitespace))) if con[...
7e37c799cb3d75f43f06fc188d2484b7f8a8386c
binoytv9/Think-Python-by-Allen-B-Downey--Exercises
/5th-chapter/2.py
208
3.828125
4
""" Write a function called do_n that takes a function object and a number, n , as arguments, and that calls the given function n times. """ def do_n(f,n): if n<=0: return f() do_n(f,n-1) do_n(foo,3)
2e4b805e936133649f3284a8e267b324cdebd940
binoytv9/Think-Python-by-Allen-B-Downey--Exercises
/8th-chapter/10.py
121
3.890625
4
def is_palindrome(string): return string == string[::-1] print is_palindrome('binoy') print is_palindrome('malayalam')
1fee1d03708f2a20b241a5b8a8c4a6ddbe7ecc2f
binoytv9/Think-Python-by-Allen-B-Downey--Exercises
/8th-chapter/1.py
154
3.90625
4
def displayback(string): index=len(string)-1 while index>=0: print string[index] index-=1 displayback("binoy") print displayback("123s546") print
80be44b952612926061985837d905e02fea488ac
binoytv9/Think-Python-by-Allen-B-Downey--Exercises
/8th-chapter/12.py
529
4.15625
4
def rotate_word(word,num): new='' for letter in word: if letter.isupper(): ordr=ord(letter)+num if ordr > 90: new+=chr(ordr-26) elif ordr < 65: new+=chr(ordr+26) else: new+=chr(ordr) elif letter.islower(): ordr=ord(letter)+num if ordr > 122: new+=chr(ordr-26) elif ordr < 97: ...
83de5b85d561953ba70ef981106499b333ad9971
binoytv9/Think-Python-by-Allen-B-Downey--Exercises
/10th-chapter/3.py
140
3.8125
4
def cumulative_sum(num_list): new=[] sum=0 for num in num_list: sum+=num new.append(sum) return new print cumulative_sum([1,2,3])
ed712831ece6915aac803fb091f6b93b1bc2f8ed
AKASHPRADUM/ASSIGNMENT1
/Assignment8.py
245
4.0625
4
a = int(input("enter yor 1st no.")) b = int(input("enter yor 2st no.")) c = int(input("enter yor 3st no.")) if a < b and a < c: print(f"a = {a} is smallest") elif b < a and b < c: print(f"b = {b} is smallest") else: print(f"c= {c} is smallest")
01b94f8e300a83461e6a4badbd98c721c4114405
enakann/FirmsDemo
/gen_proxy/data_store.py
1,808
3.609375
4
import sqlite3 import os class DataStore: """ high level support for doing this and that. """ def __init__(self, db): self.db = db self.cur = None self.conn = None def __enter__(self): self.connect() def __exit__(self, exc_type, exc_val, exc_tb): ...
232f213bf83f296708ad0352191d141e72b2d87d
ariellucass/2018.2-ProgComp
/20181206 - Dicionários/exemplo_05_criando_dicionario.py
462
3.953125
4
dicionario = {} while True: nome_fruta = input('Informe o nome da fruta (para sair digite EXIT): ') if nome_fruta.upper() == 'EXIT': break try: estoque_fruta = int(input('Informe o estoque da fruta: ')) valor_fruta = float(input('Informe o valor de venda da fruta: ')) except ValueError: ...
1442cba523d9be466df5c0b11c09430da9ee2fde
sudhamshu091/Sorting-Techniques
/tim_sort.py
1,606
4.125
4
#sorting technique used by python in sorted() #fastest sorting technique #hybrid technique #based on insertion sort and bubble sort RUN = 32 """ insertion_sort function""" def insertionSort(arr,left,right): for i in range(left+1, right,1): temp = arr[i] j = i-1 while(arr[j]>t...
5755501d833a1afc52464b94804b38bc3a91856b
sudhamshu091/Sorting-Techniques
/shell_sort.py
366
3.8125
4
def shell_sort(array): inc = len(array) // 2 while inc: for i, j in enumerate(array): while i >= inc and array[i - inc] > j: array[i] = array[i - inc] i -= inc array[i] = j inc = 1 if inc == 2 else int(inc * 5.0 / 11) list = [1,3,5...
55876b79000086f58f23a3c3c0672269c14e0fd1
wangyiyongcunyu/ichw
/pyassign1/planets.py
1,148
3.8125
4
import turtle import math wn=turtle.Screen() wn.bgcolor("black") def format(turtle,size,k): colors=['yellow','blue','red','green','orange','white','brown'] turtle.color(colors[k]) turtle.shape('circle') turtle.shapesize(size,size,1) turtle.speed(0) def orbit(turtle,x,y,z,t,d): if z==0: ...
bd4d8df6af7204858d3e6bd3401206030f1f7200
Team-Michelle-Calligraphy/calligraphy
/src/web/clients/arduino.py
1,237
3.5625
4
import serial import serial.tools.list_ports # https://www.youtube.com/watch?v=CebbJ7zrAWU # https://stackoverflow.com/questions/24214643/python-to-automatically-select-serial-ports-for-arduino # https://github.com/bborncr/gcodesender.py/blob/master/gcodesender.py # use this to set a serial port for Arduino, can be...
90bb7fee37f9872ec9a238ef8e72c02eb84f9c04
SergioGarcia1/SergioGarcia1.Github.io
/Python/Ejercicio12.py
1,116
4.09375
4
# Escribe un programa que te permita jugar a una versión simplificada del # juego Master Mind. El juego consistirá en adivinar una cadena de números # distintos. Al principio, el programa debe pedir la longitud de la cadena (de 2 # a 9 cifras). Después el programa debe ir pidiendo que intentes adivinar la # cadena ...
e76d54cc5940677074c412c56366cf6151b00970
SergioGarcia1/SergioGarcia1.Github.io
/Python/Actividad2.py
326
4.03125
4
def Maxnum(num1,num2,num3): if num1 > num2: return num1 elif num1 > num3: return num1 elif num2 > num1: return num2 elif num2 > num3: return num2 elif num3 > num1: return num3 elif num3 > num2: return num3 print(Maxnum(2,2,3...
000fb7415b53436d7b6e6cf273737b4f13e071ef
solipsia/AdventofCode2020
/3-1.py
170
3.75
4
rawdata = open("3-1.input.txt").readlines() treehits=0 x=0 for line in rawdata: if line[x%(len(line)-1)]=='#': treehits=treehits+1 x=x+3 print(treehits)
0079291271955cbe59ab68ccff4d3e25bdc67a6e
masonsbro/fall-2017-solutions
/9-22/5/ac/ethan.py
127
3.5625
4
n = int(raw_input()) ans = 0 side = 1 while side * side <= n: if n % side == 0: ans += 1 side += 1 print ans
403261709576edc7da72e810b3cefae45daab4dd
zheniamotolov/PythonCourse
/RegularTasks/Practise-1/task4.py
501
3.703125
4
A = 1 # int(input("enter A ")) B = 2 # int(input("enter B ")) C = 3 # int(input("enter C ")) result = 10 # int(input("enter result ")) x = 1 y = 1 z = 1 print("Уравнение:") print("%dx + %dy + %dz = %d" % (A, B, C, result)) i = 1 while x <= 10: while y <= 10: while z <= 10: if (x * A + y * B ...
bb4487c795faade2e8bbcd50238bdf90729cda1f
Bhaumik0018/ROYAL_AI
/task1/perceptron.py
1,004
3.5
4
import numpy as np class Perceptron(object): def __init__(self,no_of_inputs,threshold=10,learning_rate=10): self.threshold=threshold self.learning_rate=learning_rate self.weights=np.zeros(no_of_inputs+1) def predict(self,inputs): summation=np.dot(input...
2d46bb93ac403cc6ec91af67f4e700ccee472487
jakobsn/AI-programming
/project1/program_files/gen_search.py
7,191
3.734375
4
#!/usr/bin/python # python 3.5 # By Jakob Notland # Created for "Artificial Intelligence Programming" at norwegian university Of science and technology (NTNU) class GenSearch: def __init__(self, initial_node, algorithm, board_file, show_process, show_solution, display_time): self.initial_node = initial_...
19bc00052a6249859a29cbd57b55e1ac2821c175
Nsk8012/TKinter
/1.py
426
4.34375
4
from tkinter import * #import Tkinter lib window = Tk() #Creating window window.title("Print") #Giving name of the window l1 = Label(window, text="Hello World!",font=('Arial Bold',50)) #label is used to print line of text on window gui l1.grid(column=0,row=0) #grid set the position of label on window window.geometr...
4456b2f36d2c06bde279866a55d3d9e5858b0562
furukawa3152/uranai_project
/make_fortune_bySQL.py
2,014
3.71875
4
def make_fortune(): import csv import sqlite3 import random import itertools import platform if platform.system() == "Windows": encord = "ANSI" elif platform.system() == "macOS": encord = "UTF-8" def sort_number(number): # 1位には1位データ、2~8位には2位データ、41位以下には11位データ、48位には48位データ...
9020b90e8af55906abf44acc1f7cd6c2ae77ac23
teymourk/OS-CS344-
/HW5/mypython.py
1,442
3.671875
4
import random #alphabet Characters alphatbet = ['a', 'b','c','d','e','f','g','h', 'i','j','k','l','m','n','o','p', 'q','r','s', 't', 'u','v','w','x','y','z' ] def alphabeCharacters(): #create a list from all the letters and suffle it deck = list(range(0, len(alphatbet))) random.shuffle(deck) i = 0 ra...
83119fa61c4da7286fba5de1586d2df40a5bcb7f
SW1992/100-Days-Of-Code
/Forty-third-day.py
1,271
4.625
5
# Day Forty Three # Python Range & Enumerate # range() function # the python range function can be thought of as a form of loop # it loops through & produces list of integer values # it takes three parameters, start, end & step # if you specify only an end value, it will loop up to the number (exclusive) #...
d2d5b826183dc39fd5208b4ddaba0230a3426672
SW1992/100-Days-Of-Code
/Thirty-fifth-day.py
2,540
3.921875
4
# Day Thirty Five # python Overview # python is a high-level, interpreted, multi-paradigm programming language. # It was designed in the late eighties by Guido van Rossum. # It was built with readability in mind, making frequent use of the english language, over punctation. # python Syntax # indentifiers ...
2bcc4b8c656f6e5ad587d05d0a27981d63a1c6dd
SW1992/100-Days-Of-Code
/Forty-second-day.py
1,176
4.09375
4
# Day Forty Two # Python None & Placeholder Notation # None Object # The None object is the python's equivalent of null # it represents the absence of a value & has no special behaviour if 'var' in globals(): # if var exists as a global variable print(var) # print it's value else: print(...
877b943daa4c933079779fc4ce698ded061d95f9
Gadhy/t10_zena
/menus/menu5.py
869
3.734375
4
import libreria def a_Terrestres(): input("ingrese animal terrestre:") print("Animal terrestre elegida") def a_Aereos(): input("ingrese animal aerea:") print("Animal aereo elegida") def a_Acuaticos(): input("ingrese animal acuatico:") print("Aniaml acuatico elegidan") #Menus de Comando opc=0...
e971f3a6a3ed0e90dbd56d71aec3d8fe2f6544f0
Gadhy/t10_zena
/libreria.py
4,475
3.546875
4
def validar_entero(n): if (isinstance(n, int)): return True else: return False def validar_rango(n, ri, rf): if ( validar_entero(n) == True): if (n >= ri and n <= rf): return True else: return False else: return False def pedir_numero(msg...
c08712090a52aee4025a33eb492b1ff0ecb6f616
Gadhy/t10_zena
/sub_menus/sub_m4.py
1,161
3.546875
4
import libreria def Potencia(): trabajo=libreria.pedir_numero("ingrese trabajo:", 1, 20) tiempo= libreria.pedir_numero("ingrese tiempo:", 1, 20) resultado=libreria.pedir_resultado(trabajo/tiempo) contenido= resultado + "\n" libreria.guardar_datos("Calculos.txt", contenido, "a") print("datos gu...
6521e5d4fe5c174a37dae7b4ec17bd4df7e14651
Flendor/IA-Laboratories
/Tema3/game/human_strategy.py
2,138
3.890625
4
import game class HumanStrategy: @staticmethod def syntactic_check(position): while len(position) != 2 or not position[0].isdigit() or not position[1].isalpha(): position = input("Invalid position! Please try again!") return int(position[0]), ord(position[1]) - ord('A') @stat...
155a48e5cd2978f148c7c0ccf64f478ba1895ffb
blackxavier/Socket-programming
/save.py
1,686
3.75
4
#create a function to accept connection #socket must be listening before a connection can be accepted def socket_accept(): #function for accepting data conn,address = s.accept()#returns to parameters an object and a list of the ip address and a port print("Connection established. " + "\n" + "IP is " +addres...
c7b43638fc43c70772bafb02abeebdc9fe5b2a8f
Huayra-J/Helping_Hayden_in_His_Assignment
/q1.py
362
3.640625
4
#get file object reference to the file file = open("HIT137cdu.txt","r") #read content of file to string data = file.read() #get number of occurrences of the substring in the string count = data.count("You Make CDU") count2 = data.count("Great. You Make CDU") print('Number of You make CDU are:', count) print('Nu...
43e910073647c33b375c4db45e0692f2738966a9
mariandocarmo/Assuntos_do_momento
/Pesquisa_redes_sociais.py
871
3.984375
4
def linha(): print("="*35) linha() print ("1. Facebook") print("2. Instagram") print("3. Twitter") print("4. Watssap") print("5. Tik Tok") pergunta = int(input("Qual a sua rede social favorita? ")) if pergunta == 1: print("Obrigado pela sua participação! Hoje esta plataforma conta com 2,6 bilhões de usuário...
ad0eced430deb6c9cf11fa14eb47994075dbe142
iprado78/python-data-science
/week_2/stdDevLengths.py
618
3.8125
4
def stdDevOfLengths(L): if not L: return float('NaN') lengths = L#[] ''' for strin in L: lengths.append(len(strin))''' avg = sum(lengths)/float(len(lengths)) sqrDiffs = [] for length in lengths: sqrDiffs.append( (length - avg)**2 ) return ( sum(sqrDiffs) / len(sqrDiffs) )**.5 L2 = ['a', 'z'...
b00ff3915b35532efe1361d5a3c7592c853319fa
kfang7376/urop2021
/1dxe_efield
5,922
3.765625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 31 23:11:55 2021 @author: kellyfang """ import math import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt import random from random import randrange #import matplotlib.animation as animation #constants NumElec= 2 ...
9edaf10aadb9431349fc1cb7f8a46faed848327a
LRBeaver/Random
/maprender.py
9,741
3.53125
4
__author__ = 'lyndsay.beaver' import pygame from pygame.locals import * from random import randint class point: def __init__(self, pos, color=False): # Basic point, this will be used for the "feature points" # these will hold their position, as well as a seperate x and y # variab...
68244736cf34773fdbfcb939999915bb639beb93
LRBeaver/Random
/pointInCircle.py
563
3.703125
4
__author__ = 'lyndsay.beaver' import math import random def getRandomPointInCircle(radius): t = 2*math.pi*random.randint(0,5) u = random.randint(0,5)+random.randint(0,5) r = 0 if u > 1: r = 2-u else: r = u print("T is: ", t) print("U is: ", u) print("This X...
5f49b6fa32bce081f0d62c768afab560314577fb
LRBeaver/Random
/filling_function.py
1,236
3.765625
4
__author__ = 'lyndsay.beaver' import re, string, itertools def solve(rawFormula): """ rawFormula = "SEND + MORE = MONEY" Test all possible translations between Character string and Numbered string Return the Solution to the puzzle or None if no solution is found. """ for formula in...
ecb809ba80b930c9bb956e0443290510aad18658
Jose-G-Melo/PizzariaLuigi
/usuario.py
6,416
3.515625
4
from validate import Validate import os import time import json class Usuario: def __init__(self): self.typeuser = 0 self.username = None self.cpf = None self.telefone = None self.email = None self.senha = None self.accept = 0 def cadastrar(self, usuario...
2f6aa6ab8d77311fadba8a4c3fc16f6c9a4d1fa3
amenityllc/nlpday
/src/dataaugmentation.py
1,966
3.609375
4
import random import argparse import pandas as pd def augment_data(input_file: str, output_file: str): sentences_df = pd.read_csv(input_file) all_companies = set(sentences_df['company'].to_list()) all_companies = {company for company in all_companies if isinstance(company, str)} all_products = set(se...
86b410bfd6e862c894c54bcfbcf751a6f583587e
aalvarezwindey/fiuba-iasd-tp2-transport-layer
/utils/tcp_connection.py
3,255
3.703125
4
from abc import ABCMeta import socket MAX_CHUNK_SIZE = 2048 # metaclass=ABCMeta is for make an abstract class you know what i mean? class TCPConnection(metaclass=ABCMeta): # returns a string of received data until the specified separator is found # Pos: the separator is discarded from the string def recei...
90d34d6120049af498091a36c610a6fdb82eb317
AlberLC/rocket-training
/Assets/ScriptsExternos/flana_math.py
2,257
3.640625
4
import math class Vector2: def __init__(self, x, y): self.x = x self.y = y def __mul__(self, other) -> (float, 'Vector2'): if other is None: other = Vector2(1, 0) if type(other) is Vector2: return self.x * other.x + self.y * other.y else: ...
dab33c94d1f019638c12c134ccfee97b26148626
rshekhovtsov/py-intro
/week5/5_39 join_lists.py
504
3.546875
4
# 5_39 join_lists a = list(map(int, input().split())) b = list(map(int, input().split())) def merge(a, b): c = [] a_i = 0 b_i = 0 while a_i < len(a): if b_i == len(b): c.extend(a[a_i:]) break if a[a_i] > b[b_i]: c.append(b[b_i]) b_i = b...
84782fcce6bcad3fb9032cb94466ebabbb33ab9a
rshekhovtsov/py-intro
/week7/7_03 intersection.py
500
3.59375
4
# 7_03 intersection tests = [1, 2] def read_file(filename): inf = open(filename, 'r', encoding='utf-8') s = inf.read() inf.close() return s def print_list(A, sep=' '): for x in A: print(x, end=sep) print() # for t in tests: # lst = read_file('tests/7_02_' + str(t) + '.txt').split...
0e7def8706530fd68baa6830341d9daf9870da99
rshekhovtsov/py-intro
/week2/2_39 count of equal to max.py
233
3.546875
4
# 2_39 count of equal to max max = 0 c = 0 n = -1 while not (n == 0): n = int(input()) if n == 0: continue if n == max: c = c + 1 if n > max: max = n c = 1 print(c)
9f986d72e913019b4e97aef814ad510bdf50dda9
rshekhovtsov/py-intro
/week3/3_02 sum of series.py
119
3.546875
4
# 3_2 sum of series n = int(input()) s = 0 i = 1 while i <= n: s = s + 1 / (i ** 2) i = i + 1 print(s)
87859b9a5c9de10a9bccde67e291dc2d7f5f8301
rshekhovtsov/py-intro
/week2/2_1 max of two.py
110
3.84375
4
# 2_1 max of two a = int(input()) b = int(input()) if a > b: max = a else: max = b print(max)
2bb0f9803752d8653d5661b8a7ce6895a0a88a93
rshekhovtsov/py-intro
/week3/3_6 percents.py
199
3.78125
4
# 3_6 percents p = int(input()) x = int(input()) y = int(input()) s = float(x * 100 + y) # s2 = s * (100 + p) / 100 print(int(s2 // 100), int(s2 % 100))
c3a81e455e13111e4f3d39301727e1b8a20ae464
codingandcommunity/intro-to-python
/beginner/lesson7/caesar.py
494
4.15625
4
''' Your task is to create a funcion that takes a string and turns it into a caesar cipher. If you do not know what a caesar cipher is, here's a link to a good description: https://learncryptography.com/classical-encryption/caesar-cipher ''' def makeCipher(string, offset): # Your code here return string s = i...
b530e63e5290ca037d25b0d547fee2f963b91a26
codingandcommunity/intro-to-python
/beginner/lesson7/piglatin.py
655
4.28125
4
''' Write a function translate that translates a list of words to piglatin ex) input = ['hello', 'world'] output = ['ellohay', 'orldway'] remember, you can concactenate strings using + ex) 'hello' + ' ' + 'world' = 'hello world' ''' def translate( ): # Your code here phrase = (input("Enter a phrase -> ")...
e80b4468fc378cd60fe357f3ecfd906e8873b8ab
liechtym/machine-learning-algorithms
/ID3/tree.py
1,399
3.953125
4
class Tree: def __init__(self, label="root", treeLevel = 0): self.childNodes = {} self.treeLevel = treeLevel self.label = label self.splitOn = "" self.entropy = -1 # Make each possible value an attribute, where the empty object will be released # When you pr...
4ca3fba1fbc47cbf55d8e2845417351eb984346f
meshulam/GRUV
/data_utils/labelers.py
580
3.53125
4
# A labeler function takes a list of blocks with length L, and a name, # and returns a list of labels also of length L, where each label describes # block with the same index. names = [] # TODO: move this state into a Labeler object def by_name(blocks, name): labels = [] if name not in names: names.a...
8a6c7b2168c58be52a5d8d1987c71383b72e5552
Fashad-Ahmed/Python-Practices
/enumerate.py
161
3.578125
4
a = ["CHERRY", "PUMPKIN", "JELLY", "BROWN SUGAR"] for i, item in enumerate(a): print(i, item) # i = 0 # for item in a: # print(i, item) # i += 1
591180171aa0bb1ce232b11d90380ba9711736e1
adivyas99/Sentiment-Prediction-by-Restraunt-Reviews
/natural_language_processing.py
1,769
3.546875
4
# --Sentiment Prediction using Natural Language Processing-- # 1. Data Preprocessing-- # Importing the libraries import numpy as np #For Numerical calculations import matplotlib.pyplot as plt # For Data Vizualization import pandas as pd # For Data Management import re import nltk # For implementing NLP from sklea...
17c27392ad3c407a01a144ae804e7377197d0d5a
bisht-100rav/Assignments
/Assignment_15.py
848
3.75
4
#Ques_1 import re emails="zuck26@facebook.com""pages33@google.com""jeff42@amazon.com" des_op=re.findall(r"([\w]+)@([\w]+).([com]+)",emails) #Using grouping syntax for grouping text print(des_op) #Que_2 text="Betty bought a bit of butter,But the butter was so bitter,So she bought some better butter...
c70d4e6a28ff76afe0909ec7110a57703512fc39
bisht-100rav/Assignments
/Assignment_6.py
1,731
4.03125
4
#Ques_1 i=0 while i<10: a=int(input("Write any number: ")) i=i+1 print(a) #Ques_2 while True: print("This is an infinite loop") #Ques_3 num=int(input("Number of elements you want in list: ")) i=0 b=[] square=[] while i<num: a=int(input("Write an integer %d: "%(i+1))) b.append(a) square...
6f5b4a260426de11c79686367fc4d854d3d2c10a
carlosarli/Learning-python
/old/str_methods.py
458
4.21875
4
name = 'lorenzo' #this is a string object if name.startswith('lo'): print('yes') if name.find('lo') != -1: #.find finds the position of a string in a string, and returns -1 if it's not succesfull in finding the string in the string print('yes') delimiter = '.' namelist = ['l', 'o', 'r', 'e', 'n', 'z', 'o'] pri...
91c39683a18a2609ce14d0173b18854bf1572ee1
carlosarli/Learning-python
/old/func_doc.py
209
3.90625
4
def area(a,b,c): '''Prints the product of three numbers The three numbers must be integers''' a = int(a) b = int(b) c = int(c) print(a * b * c) area(3, 1000, 7.3) print(area.__doc__)
4349ec3ae67d73d5fd3bf22a1e8476780df76efa
AkshayGulhane46/hackerRank
/06_Loops.py
119
3.546875
4
if __name__ == '__main__': n = int(input()) for ele in range(n): square=ele*ele print(square)
e7ce661b78ca1fb34ee44f025de804f0fc4cec29
AkshayGulhane46/hackerRank
/15_string_split_and_join.py
512
4.28125
4
# Task # You are given a string. Split the string on a " " (space) delimiter and join using a - hyphen. # # Input Format # The first line contains a string consisting of space separated words. # # Output Format # Print the formatted string as explained above. def split_and_join(line): a = line.split(" ") # a is ...
0c8b0b02beafdf84228838fe327a16559b51b06f
leyderpacheco/Ejercicio2python
/main.py
315
3.84375
4
#numero par o impar def calculo(): print("Numero Par o Impar") numero=int(input("NUmero :")) if numero %2 == 0: print(f'el NUmero {numero} es par ') return "par" else : print(f'el NUmero {numero} es impar ') return "impar" if __name__ == '__main__': calculo()
6427a70589e97a8373e024aed30802246b30805b
db758/A2---Color-Models
/a3test.py
10,630
3.53125
4
""" Unit Test for Assignment A3 This module implements several test cases for a3. It is complete. You should look though this file for places to add tests. a3test Debasmita Bhattacharya (db758) Myka Umali (meu22) October 1, 2017 """ import cornell import a3 def test_complement(): """ Test function comp...
e4abc0b027bee7028730918ee978a15138e49063
Venergon/ProjectEuler
/src/projecteuler/previoussolutions/Problem24_LexicographicPermutations.py
885
3.8125
4
def lexicographicPerm(currentNum, soFar, depth): currentSoFar = soFar if depth == 9: for i in range(10): if str(i) not in currentNum: currentSoFar += 1 currentWord = currentNum + str(i) #print(currentWord, "depth :", depth) if c...
0ac2ac537a47c7ff3675308100511f4371e1bd3a
Venergon/ProjectEuler
/build/classes/projecteuler/previoussolutions/Problem16_PowerDigitSum.py
102
3.921875
4
digitSum = 0 power = str(pow(2, 1000)) for digit in power: digitSum += int(digit) print(digitSum)
43724a1315e70dada938751f232aa354d435814a
rlyspn/helper_scripts
/stats
754
3.65625
4
#!/usr/bin/python ''' Given a file with 1 float per line prints: mean median stdev min max 25_percentile 75_percentile ''' import numpy as np import sys def get_floats(input_path): floats = [] with open(input_path) as ip: floats = map(float, [x for x in ip if len(x) > 0]) return floats if len(...
69e839e580b716f73ff39f5d71b143dcb1e1f75b
hrishiwaikar/Sudoku-Solver
/sudoku_solver_advanced.py
28,627
3.875
4
# Sudoku Solver # Author: Hrishikesh Waikar #Notes ''' try to solve the board as much as possible through basic techniques once there are no improvements, switch to advanced mode First find ''' import copy ''' Represents a number and it's 2 possible positions, one of which is going to be correct. ''' class DualPos...
0d9f9adaa6356f7dfbc85226d5d01ae839b54d70
gyyyy2/201601423
/day13_hw.py
2,053
3.546875
4
import turtle as t import random # 500 by 500 사각형 만들기 t.up() t.goto(-250,-250) t.down() t.pensize(2) t.goto(250,-250) t.goto(250,250) t.goto(-250,250) t.goto(-250,-250) # 사각형 가운데로 t.up() t.goto(0,0) # 거북이 움직이기 t.down() t.shape("turtle") t.pensize(1) # 랜덤 설정된 각도로 회전 후 벽까지 이동 a=random.randint...
625abfb54078aa303cfc1e7d9f358a0fc1b6528d
kolodziejp/Learning-Part-1
/Smallest_Value.py
343
4.28125
4
# Finding the smallest value in a range small = None print ("Let us look for the smallest value") for number in [21, 42, 13, 53, -5, 2, 56, 119, -23, 99, 2, 3, 9, 87]: if small is None: small = number elif number < small: small = number print (small, number) print ("The smalle...
c5f22e3b607f0af078e1506feb80d6d81041862c
kolodziejp/Learning-Part-1
/Ex_5_1.py
480
4.1875
4
# entered numbers are added, counted and average computed count = 0 total = 0 while True: num = input ("Enter a number: ") if num == "done": break try: fnum = float(num) #convert to floating number except: print ("Invalid Data!") continue # should...
b7ac651e4b12fcffd12bc32ed323695cb8bed52e
Askanio234/lesson1
/homework/valera.py
386
3.828125
4
if __name__ == '__main__': List = ['Вася', 'Маша','Петя', 'Валера', 'Саша', 'Даша'] #while List: #person = List.pop() #if person == 'Валера': #print('Валера нашелся!') #break def find_person(name): while List: person = List.pop() if person == name: print('{} нашелся!'.format(name)) find_perso...
60df28ce908bb4db211de9f477f3cd5ac9443ded
Jac21/GistsCollection
/Python/IntermediatePython/Coroutines/Coroutines.py
672
3.921875
4
""" Coroutines - similar to generators, with a few differences: 1. Generators are data PRODUCERS 2. Coroutines are data CONSUMERS Generator - def fib(): a, b = 0, 1 while True: yield a a, b = b, a + b for i in fib(): print(i) """ def grep(pattern): print("Searching for ", pattern) while True: line = ...
ea70770ecd93bd542a1682b7619565843fc6f627
Jac21/GistsCollection
/Python/Rosalind/3 - Complementing a Strand of DNA.py
768
3.84375
4
""" Problem In DNA strings, symbols 'A' and 'T' are complements of each other, as are 'C' and 'G'. The reverse complement of a DNA string ss is the string scsc formed by reversing the symbols of ss, then taking the complement of each symbol (e.g., the reverse complement of "GTCA" is "TGAC"). Given: A DNA string ss o...
5c7c8bfe888c4b64033a7b4f41bd201d226f8d14
Jac21/GistsCollection
/Python/MatasanoChallenges/Set 1 - Basics/SetOneQuestionThree/SetOneQuestionThree/SetOneQuestionThree.py
345
3.6875
4
""" Single-byte XOR cipher The hex encoded string: 1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736 ... has been XOR'd against a single character. Find the key, decrypt the message. """ import binascii import sys s = "1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736" decodedSt...
d9c8c49714ac5fb7b2aecac4614887716e5d836c
dlew253/hangman
/app.py
3,275
3.96875
4
import random #set word list def get_word(): words = [ "kitty", "baseball", "poop", "apple", "coffee", "draco", "sharpen", "gourd", "noodle", "sharpie", "hoarse"] return random.choice(words) # set up game field def play(word): word_completion = "_" * len(word) guessed...
57572036fe01948e7cd8af24e7d41eb5c77b4977
varungv/ipl-status-web-app-demo
/ColorGenerator.py
884
3.78125
4
import random class ColorGenerator: """This is a module to generate colors """ def __init__(self): self.selected_colors = [] def get_colors(self, transparency=0.5): """Generator which list colors infinitely""" count = 0 while True: count += 1 color...
a6371a6df6648cd257945b3433824f5f2b4f8c99
666graham666/-
/ex7.py
159
3.875
4
import turtle import math g = turtle.Turtle() g.shape('turtle') x = 0 while True: g.forward(x / 2 * math.pi) g.left(2 * math.pi) x += 0.1 input()
eb94db21432787349ffa87f4d1c7ea2da625a8c4
Savirman/Python_lesson01
/example04.py
1,065
4.25
4
# Программе нахождения наибольщей цифры в числе # Пользователь вводит целое число произвольной длины while True: number = int(input("Введите целое положительное число: ")) # Проверяем введенное число. Если оно отрицательное, то выдаем сообщение об этом и просим ввести положительное число if number < 0: ...
92105cba27ea723d3a7166c6931883f35934b58b
comicphile/MachineLearningA-Z
/D1_SimpleLinearRegression.py
1,379
3.640625
4
# -*- coding: utf-8 -*- """ Created on Sun Jul 7 21:21:32 2019 @author: imkri """ import numpy as np import matplotlib.pyplot as plt import pandas as pd dataset=pd.read_csv('Salary_Data.csv') X=dataset.iloc[:,:-1].values #independent features y=dataset.iloc[:,1] #Splitting the dataset into train...
4bc483c51ee0afcf5a7703dae40a5fcea2f64002
Rishant96/Expert-Python
/Raymond_Hettinger-super/ordered_counter.py
554
3.84375
4
from collections import Counter, OrderedDict """ Somewhat redundant, as of python 3.7 because standard dictionaries in python are now ordered """ # Using 'super' to create OrderedCounters class OrderedCounter(Counter, OrderedDict): """Counter that remembers the order elements are first seen in""" def __rep...
2819b69aa78cf217844e1667d077354ad087a6fb
babiswas/Tree
/test13.py
1,315
3.890625
4
class Node: def __init__(self,value): self.value=value self.left=None self.right=None def lca(node,val1,val2): left=None right=None if not node: return None else: if is_present(node,val1) and is_present(node,val2): if node.value==val1 or node.va...
ac3df8928216b2811ce22c20e5adf90148eec04c
babiswas/Tree
/test28.py
1,817
3.765625
4
class Node: def __init__(self,value): self.value=value self.left=None self.right=None self.explored=False def reset(self): if self: if self.right: self.right.reset() self.explored=False if self.left: self.left.rese...
6de5e9b61a024483ad24e9932b4562e4f0b700bb
insomniafox/katas
/Codewars/UserclassforBankingSystem.py
858
3.796875
4
class User(object): def __init__(self, name, balance, checking_account): self.name = name self.balance = balance self.checking_account = checking_account def withdraw(self, money1): self.balance -= money1 if money1 > self.balance: raise ValueError ...
39b8769714b329f8b614dc1180e3709b31361cf4
FacundesPedro/Snake_PY
/main.py
2,417
3.609375
4
import pygame,sys import random #Variables red = (255,0,0) blue = (50,100,213) orange = (205,102,0) size = (600,600) xi = 200 yi = 200 dx = 0 dy = 0 x_food = 140 y_food = 460 position_list = [[xi,yi]] snake = { "width":20, "height":20, } display = pygame.display.set_mode(size) pygame.display.set_caption('J...
1a7746fd1f7a01c891a3d827eb630dc8c723c8b5
josephhaaga/Fundamentals
/Data_Structures/ArrayList.py
1,036
4
4
# An array that resizes itself as needed while still providing O(1) access. # A typical implementation is that when the array is full, the array doubles in size. # Each doubling takes O(n) time, but happens so rarely that it's amortized insertion time is still O(1) RESIZING_FACTOR = 2 class ArrayList: elements = ...
f810827a87a2c975f9a6a33c333c8c606278047c
abhaypal7/stone-paper-scissors
/stone paper scissors.py
966
4
4
#!/usr/bin/env python # coding: utf-8 # In[ ]: import random moves =['stone','paper','scissor'] computer=random.choice(moves) name=input('Enter your name: ') player =False while player==False: your_move=input('stone or pape') if your_move==computer: print('its a tie') elif your_move== 'stone': ...
80490e582b73a5753c3de15db371c0a87ff8f5cd
fernandmorausky/Python-Area-51
/lesson_07/proof.py
737
4.0625
4
class Proof: def __init__(self, attr1, attr2): self.attr_public = attr2 self._attr_private = attr1 self.__attr_super_private = attr1 + attr2 def __method_private(self): print(self._attr_private) proof = Proof(2, 3) # Lanza error, se ocultan método y atributo # proof.__method...
c732a852c3e4154f311ad8175f1ea109cd0745d9
cas3y/Word_Made_Digital
/lamborghiniaccount.py
345
4.03125
4
import sys # create an integer variable to accumulate # word count word_count = 0 for line in sys.stdin: line = line.strip() words = line.split(" ") line_word_count = len(words) word_count = word_count + line_word_count # print the total number of words print "you have", word_count, "lamborghinis in ...
b643271a7e6d6a6b175a12d8f06935dc31778e38
Jav10/Backpropagation-NN
/multipleHiddenLayer.py
1,625
3.90625
4
#Importamos la libreria numpy import numpy as np #Función de activación ReLu def Relu(input): '''Funcion de activacion - ReLu''' output = max(input, 0) return(output) def predict_with_network(input_data): # Calculamos el nodo_0 en la primera capa oculta node_0_0_input = (input_data * weights['no...
e925e128a91016a06b95f1c88d3c9a7f8c1628f8
ApurvaW18/python
/Day 3/Q2.py
377
4.25
4
''' 2.From a list containing ints, strings and floats,make three lists to store them separately. ''' l=['aa','bb','cc',1,2,3,1.45,14.51,2.3] ints=[] strings=[] floats=[] for i in l: if (type(i))==int: ints.append(i) elif (type(i))==float: floats.append(i) else: string...
0ccd24589fd5833bd9dd205fe3bf34a315f533eb
ApurvaW18/python
/Day 6/Q2.py
678
4.125
4
''' 2.Write program to implement Selection sort. ''' a = [16, 19, 11, 15, 10, 12, 14] i = 0 while i<len(a): s=min(a[i:]) print(s) j=a.index(s) a[i],a[j] = a[j],a[i] i=i+1 print(a) def selectionSort(array, size): for step in range(size): min_idx = step for i...