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
f709e81f930cfaecb5ec48e276ed0de49f3ce4dc
use12345/project-100-ATM-BANK
/atm.py
840
3.765625
4
class Atm(object): def __init__(self,atmcardnumber,pinnumber): self.atmcardnumber=atmcardnumber self.pinnumber=pinnumber def CashWithdrawl(self,amount): newamount=50000-amount print("CashWithdrawl Successfully") print("your balance is"+str(newamount)) def B...
c1276aba78dec428b0c57d62f50d37ded661a050
leandrocl2005/math-with-python-turtle
/008-drawCustomParametrics.py
1,819
3.84375
4
import turtle import tkinter as TK import numpy as np import math screen = turtle.getscreen() ted = turtle.Turtle() screen.bgcolor("red") ted.speed(9) ted.shapesize(1, 1, 1) ted.pensize(3) ted.pencolor("white") ted.fillcolor("blue") ted.shape("turtle") # paramétricas da parábola # def parametric_x(t): # return ...
161970ee8d7f758ab490d6a2dbc9dfa5be414340
Prajwal-Adhikari/BernoulliEquation
/rancaswes.py
476
3.671875
4
import random lower = int(input("Enter a lower limit : ")) upper = int(input("Enter a upper limit : ")) samples = int(input("Enter how many sample number u want : ")) output = [] print(output); file = open('samples.csv','w') for x in range(samples): randomsample = random.randint(lower,upper) output.append(rando...
4091f75ecc4ebddae7b1c6eb7e6213da6355d0e2
Jupchurch2/SoftwareProject
/AirplaneSeating/Plane.py
1,314
3.875
4
from typing import Optional import Passenger class Seat: def __init__(self, seatNumber: int, isOpen: bool = True) -> None: """ :param seatNumber: Seat number to be associated with the object :param isOpen: Availability status """ self.isOpen = isOpen self.seatNumber...
53d9ae18d38229a6351ddda05a8bd552f84df9b9
ceirius/ArcherDx
/Task3-Shreyas.py
10,567
3.578125
4
#!/usr/bin/env python # coding: utf-8 # # Given a chromosome and coordinates, write a program for looking up its annotation. Keep in mind you'll be doing # this annotation millions of times. # # -Input: # o Tab-delimited file: Chr<tab>Position # o GTF formatted file with genome annotations. # # -Output: # o...
ec714b2acb6dba211817622978010704132a8227
pjguti/30DaysOfCode_HackerRank
/day8.py
402
3.5
4
import random if __name__ == "__main__": n=int(input()) phoneBook = dict() for i in range(n): friend = input() friend = friend.split() name = friend[0] phone = friend[1] phoneBook[name]=phone for j in range(n): m = input() if(phoneBook.get(m)): print(m.st...
1a0d90cc0ef6bf0ffdaa08352520095b3a946cda
IAmOZRules/Network-Packet-Sniffer
/mac.py
726
3.6875
4
import textwrap # Returns MAC as string from bytes (ie AA:BB:CC:DD:EE:FF) def return_mac_address(mac_raw): byte_string = map('{:02x}'.format, mac_raw) mac = ':'.join(byte_string).upper() return mac # formats the data into multiple-lines to make it easier to read def format_output(prefix, string, size=80)...
43fa4e586cef9e88dc66931bf55d94d5f3d17f0d
yangliu28/swarm_formation_sim
/loop_reshape_test_power.py
1,008
3.71875
4
# demo of how power function can increase the unipolarity of a random distribution # pass the exponent of the power function in the command line # ex: 'python loop_reshape_test_power.py 1.3' import matplotlib.pyplot as plt import numpy as np import random, time, os, sys # get the exponent from passing parameter expo...
568437018fe6aa5103741dd05182def28e26f0e8
yangliu28/swarm_formation_sim
/loop_formation_robot.py
2,208
3.5
4
# robot class for loop formation simulation class LFRobot: # LF stands for loop formation def __init__(self, pos, vel, ori): # position, velocity, and orientation for the physics self.pos = list(pos) # convert to list self.vel = vel # unsigned scalar self.ori = ori # moving direc...
45a40a985389c285e1a9513c1dd1841371f83cfe
yangliu28/swarm_formation_sim
/line_formation_1.py
51,068
3.875
4
# first line formation simulation of swarm robots, using climbing method to form the line # comments for research purpose: # My previous line formation simulations in ROS utilize the relative positions of nearby # neighbors, and linear fit a line and move to the desired position. It only works when # there are many ro...
d6cebd1744f35e6f1375a62892472aa8d16cede0
Danzydan/Danzydan
/3.py
199
3.859375
4
3. num = int(input('input the number: ')) if num in range(1,11): for i in range(1,11): print(str(num) + ' x ' + str(i) + ' = ' + str(num*i)) else: print('Invalid number')
d9816ac73df50f5676313824859a15b10485a7c4
affreen/Python
/pyt-14.py
511
4.28125
4
"""demo - script that converts a number into an alphabet and then determines whether it is an uppercase or lowercase vowel or consonant""" print("Enter a digit:") var=input() var=int(var) new_var=chr(var) #if(new_var>=97 and new_var<=122): if (new_var in ['a','e','i','o','u']): print("You have entered a...
6b30a77dc8f6aed74527ac00d88955a6238b2631
JoyceYF/Build-Dialogue-System-By-Yourself
/src_code/chap06/Movie-KBQA/src/question_preprocess.py
1,249
3.53125
4
#!/usr/bin/env python # _*_ coding:utf-8 _*_ import re def text_processing(text): ''' 对用户输入的问题文本进行清理 :param text: :return: ''' text = text.replace(' ', '') clean_text = clean_punctuation(text) # 过滤非中文字符 pattern = re.compile("[^\u4e00-\u9fa5]") clean_text = re.sub(pattern, '', c...
2a0396f44095b17be60c277b1adedf5b0c79e5fe
rockrunner/my_code
/codetest/function.py
1,816
3.609375
4
class Function: def __init__(self): pass # 有效的数字只能由-,. 和数字构成,且负号只能有1个并且必须在第1位,小数点也只能有1个,数字至少必须有1个。 # def check_number(self, number): # is_valid = True # is_correct = True # point = 0 # minus = 0 # digit = 0 # # for char in number: # a...
a3b0dd150445b553e7440afb435bcfc21e685cbc
jessica-lemes/exercicios-python
/Ex. 11 EstruturaDeRepeticao.py
213
4.0625
4
num1 = int(input("Informe o primeiro número: ")) num2 = int(input("Informe o último número: ")) soma = 0 while num1 < (num2-1): num1 += 1 soma += num1 print(num1) print("números somados: ",soma)
dd28c86187a9363045d934c4822595a71952505f
jessica-lemes/exercicios-python
/Ex. 19 EstruturaDeRepeticao.py
498
4.03125
4
lista = [] numeros = -1 while numeros != 0: numeros = int(input("Informe um número ou digite 0 para sair: ")) if numeros != 0: if numeros < 0 or numeros > 1000: print("Informe apenas numeros maiores que 0 e menores que 1000 ") else: lista.append(n...
3711dd69baa3d6e06dc54919f9d825c2e0cc5915
jessica-lemes/exercicios-python
/Ex. 10 EstruturaDeDecisao.py
287
4.09375
4
periodo = input("Qual o período que você estuda? (M-Matutino, V-Vespertino, N-Noturno): ") if periodo.upper() == "M": print("Bom dia") elif periodo.upper() == "V": print("Boa tarde") elif periodo.upper() == "N": print("Boa noite") else: print("Período inválido")
adab05b5b8f3abee46d2c66759e830d86b787dbf
jessica-lemes/exercicios-python
/Ex. 12 EstruturaDeDecisao.py
1,087
4
4
valor_hora = float(input("Informe seu salario/hora: ")) horas_trabalhadas = float(input("Informe as horas trabalhadas no mês: ")) salario_bruto = valor_hora * horas_trabalhadas inss = salario_bruto * 0.10 fgts = salario_bruto * 0.11 def desconto_ir(salario_bruto): if salario_bruto < 900: desconto = 0 ...
681e63dd06b1a2058064208864fe5e19b15e90eb
jessica-lemes/exercicios-python
/Ex. 14 EstruturaDeRepeticao.py
278
3.90625
4
count = 0 pares = 0 impares = 0 while count < 10: numero = int(input("Informe um número inteiro: ")) count += 1 if numero % 2 == 0: pares += 1 else: impares += 1 print("O total de números pares é: ", pares," e números ímpares: ", impares)
390edf97979e1a8198192694de246a6796d7a65e
jessica-lemes/exercicios-python
/Ex. 04 EstruturaSequencial.py
412
3.890625
4
'''Faça um Programa que peça as 4 notas bimestrais e mostre a média.''' def media(): nota1 = float(input("Informe a primeira nota: ")) nota2 = float(input("Informe a segunda nota: ")) nota3 = float(input("Informe a terceira nota: ")) nota4 = float(input("Informe a quarta nota: ")) media = (nota1+n...
16c057f582352d927dd89d2324f2d878d9a1196b
jessica-lemes/exercicios-python
/Ex. 02 EstruturaDeRepeticao.py
260
4.03125
4
nome = input("Informe o nome: ") senha = input("Informe a senha: ") while senha == nome: print("A senha não pode ser igual ao nome de usuário!") nome = input("Informe o nome: ") senha = input("Informe a senha: ") print("Seja bem vindo(a)", nome)
771614df7cae6b825c2c1f1115b0b079b71fe4d8
jessica-lemes/exercicios-python
/Ex. 26 EstruturaDeRepeticao.py
839
4.0625
4
'''Numa eleição existem três candidatos. Faça um programa que peça o número total de eleitores. Peça para cada eleitor votar e ao final mostrar o número de votos de cada candidato.''' eleitores = int(input("Informe quantos eleitores irão votar: ")) candidato = 0 candidatoUm = 0 candidatoDois = 0 candidatoTres = 0 nulo...
1653237f5483f98a970e6554f2577f5620395d62
maddisson1/cciq
/strings/check if strings are a rotation of each other.py
292
4
4
def rotation(s1, s2, char): if len(s1) != len(s2): return False else: rotate = s1[char:] + s1[:char] if rotate == s2: return 'yes' else: return 'no' s1 = input() s2 = input() char = int(input()) print(rotation(s1, s2, char))
da016e491f8522c38ad6d2f70250a7309b00f293
maddisson1/cciq
/arrays/finding primary numbers.py
969
4.03125
4
''' Нахождение простых чисел/чисел, которые делятся на 1 и на себя. Проходимся по числам по очереди, если у числа есть хоть один делитель, останавливаем цикл, иначе добавляем в массив ''' n = int(input()) #запрашиваем диапазон (конечное число) prime_num = [] # пустой массив для результата for i in range(2, n+1): # пр...
c4a5a13a255f176d8e72e706119683dd1a7dd909
maddisson1/cciq
/strings/check if string is palindrome.py
184
4.09375
4
def palindrome(string): rotation = string[::-1] if rotation == string: return 'hell yeah' else: return 'f no(' string = input() print(palindrome(string))
f33786d90ed22092a69a7114e274fd8610c4d278
admcghee23/RoboticsFall2019GSU
/multiCpuTest.py
2,198
4.3125
4
#!/usr/bin/env python ''' multiCpuTest.py - Application to demonstrate the use of a processor's multiple CPUs. This capability is very handy when a robot needs more processor power, and has processing elements that can be cleaved off to another CPU, and work in parallel with the main application. ...
efda8ad51efe2cdd752a8b889123b8b460636961
abdullah13295/cd101
/1Composer.py
679
3.734375
4
n=int(input("please Enter number of composers: ")) f_names=[] l_names=[] b_years=[] d_years=[] ages=[] sum=0 for i in range(n) : print(f"composer num {i+1}") full_data=input(" Enter first name , last name , birth year , death year separated by space: ").split(" ") f_names.append(full_data[0]) l_names.ap...
3de0b57d028d03619a2741f4087012623a791e00
Xavhyatt/Python
/basicExercises/conditionals.py
151
3.890625
4
def add_or_multiply(a,b,c): if c == True: return a+b else: return a*b a = 10 b = 20 c = False print(add_or_multiply(a,b,c))
ee9500ccae20bd178e8d7e7cebcf555cc8dcad17
Xavhyatt/Python
/testPython/Loops.py
417
4.03125
4
student_names = ["James", "Katarina", "Ahri", "Zed", "Talon", "Ekko", "Ori"] # Testing break function for name in student_names: if name == "Ekko": print ("Found Them! " + name) break print("Currently testing " + name) # Testing Continue function for name in student_names: if name == "Zed"...
ee7c8d4a5f1cc5da86a5a94aa5d4675106cdf52d
Anisha2001/NewToPython
/Q5.py
395
3.984375
4
# prime=[] n=int(input("Enter a number = ")) l=100 i=1 while i<=l: c=0 j=1 while j<=i: if i%j==0: c+=1 j+=1 if c==2: prime.append(i) i+=1 if (i-1)==l: if (c==2): print("Input number is prime") else: print("Input number is...
39023fd959569b11c6020dc4e2951dce4f35b001
andersonnatasha/Studying
/matrix.py
3,205
4.125
4
# Consider a square matrix with sides of even length. # Define its 0-border as the union of left and right columns as well as top and bottom rows. # Now consider the initial matrix without the 0-border. Its 0-border is 1-border for the initial matrix. In the same way one can define 2-border, 3-border, etc. # Given a...
853983ec54d6fee56891792dd54356b6735f645a
hrvach/CheckiO
/The Rows of Cakes.py
483
3.5625
4
from itertools import combinations from fractions import Fraction def checkio(cakes): lines, verticals = set(), set() for (x1,y1),(x2,y2),(x3,y3) in combinations(cakes, 3): if x1==x2==x3: verticals.add(x1) elif [x1,x2,x3].count(0)<2 and x1!=x2: ...
df155ebb662ac461dca90acd84548c9a41c51228
jonathanshi568/BracketEvaluator
/app/database.py
2,743
3.6875
4
"""Defines all the functions related to the database""" from app import db def fetch_teams() -> dict: conn = db.connect() results = conn.execute("SELECT * FROM teams LIMIT 100;") conn.close() teams_list = [] for r in results: team = { "id": r[22], "TeamName": r[0], ...
508217af5594b2d8425fc5bb503a614b40d47b3d
ComputingTelU/SG-Basic-Gen.03
/Pertemuan 3 ( Stack & Queue )/Contoh Program/queue.py
525
3.71875
4
class Queue: def __init__(self): self.items=[] def isEmpty(self): return self.items==[] def enqueue(self,item): self.items.insert(0,item) def dequeue(self): return self.items.pop() def size(self): return len(self.items) def getList(self): ...
cb4e33c6ff6cffbfd03185621df4cc82c7dd82cc
ComputingTelU/SG-Basic-Gen.03
/jawabwiwit.py
800
3.703125
4
class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[len(self.items...
6214f1f65b623bc637c1f1463f627a9c9e37cf83
Mahe7461/Python
/Python IDEL/Dictionary comprehension.py
156
3.796875
4
# Dictionary comprehension keys=['a','b','c','d','e'] val=[1,2,3,4,5] dic=dict(zip(keys,val)) print(dic) mydic={x: x**2 for x in [1,2,3,4,5]} print(mydic)
18646e411b6caf292796e43014e8093d9c818655
Mahe7461/Python
/Python IDEL/comparison operator.py
257
4.25
4
#comparison operator a=10 b=20 if a==b: print('equal') elif a!=b: print('not equal') elif a>b: print('greater than') elif a<b: print('less than') elif a>=b: print('greater than or equal to') elif a<=b: print('less than or equal to')
cdf5f4de3601d4242d14a34728f0843f5ee5770c
Mahe7461/Python
/Python IDEL/classes.py
739
4.0625
4
#classes class Number:#creating class x=10 num=Number()#creating object print(num)#calling the object #classes with main function class person: def __init__(self,name,age): self.name=name self.age=age p1=person('ram',24) print(p1.name) print(p1.age) class person1: def __init__(self,name,...
0a5ecb708fb9d448e99bef03d1f640596a67776c
adi5krish/Machine-Learning
/py-1/K-means clustering.py
2,402
3.65625
4
import math import random dataset = open("C:\Users\DELL-PC\Desktop\ML\py_codes\py_codes\py_question1\iris.txt","r") tempList = [] mainList = [] class1 = [] class2 = [] class3 = [] label = 1 for i in range(150): tempList = dataset.readline().split(",") tempList = [float(x) for x in tempList[0:4]] if i...
2d09195882dc7a14a33aea4a3c6da4c183cb59ba
wiramahardika/KIJ2017
/diffie-hellman key exchange/dh_key_exchange.py
678
3.6875
4
import random def generateLargePrime(): while True: p = random.randrange(1000, 9999, 2) if all(p % n != 0 for n in range(3, int((p ** 0.5) + 1), 2)): return p def generateSmallPrime(): while True: p = random.randrange(20, 999, 2) if all(p % n != 0 for n in range(3, ...
ec5302a675beb1d491e7e5af2cb8ebd50566a7e3
eloyhz/Exercism
/python/matrix/matrix.py
656
3.515625
4
class Matrix: def __init__(self, matrix_string): self.matrix = [] # get a list of rows (string with numbers separated by spaces) r = matrix_string.split('\n') for s in r: # get a list of columns (numbers as strings) row = list(map(int, s.split())) ...
25769d8d3585d08627c5b35e6ac1ca7547033ca4
wangyang1749/python
/order/学生管理/main3.py
5,900
3.96875
4
#定义一个函数,显示可以使用的功能列表给用户 def showInfo(): ''' 显示可以使用的功能列表给用户 ''' print("-"*30) print(" 学生管理系统 ") print(" 1.添加学生的信息") print(" 2.删除学生的信息") print(" 3.修改学生的信息") print(" 4.查询学生的信息") print(" 5.遍历所有学生的信息") print(" 0.退出系统") print( '-'*30) #定义一个列表,用来存储多个学生的信息 students=[] ...
c7d0404c184ff42bd90467f8aebe5c6d1ac185a9
csuzll/PyDesignPattern
/创建型/SimpleFactory.py
1,093
4.4375
4
""" 简单工厂模式: 集中式生产 """ # 斧头: 产品抽象类 class Axe(object): def __init__(self, name): self.name = name def cutTree(self): print("%s斧头砍树" % self.name) # 花岗岩石斧头: 子产品类 class StoneAxe(Axe): def cutTree(self): print("使用%s砍树" % self.name) # 铁斧头: 子产品类 class SteelAxe(Axe): def cutTree(self)...
a77962315eae34fc8efbcb456cc43237a8d2eed8
Thundzz/advent-of-code-2020
/py/day_01/solve.py
794
3.578125
4
def parse_input(filename): with open(filename) as file: return [int(l.strip()) for l in file.readlines()] def find_expenses_firststar(expenses): expensesSet = set(expenses) for expense in expenses: other = 2020 - expense if other in expensesSet: return expense * othe...
815545098a2833a855a4fb63ec68197f87b000f4
liamhart/Turn-Based-Game
/battle.py
2,978
3.734375
4
# -*- coding: utf-8 -*- """ Created on Wed Sep 6 12:44:20 2017 @author: Liam Hart """ import classes import time enemy = classes.Tank() player = classes.Tank() def checkInvincibility(Target): if Target.invincibility > 0: Target.decrementInvincibility() return 0 else: ...
97603a8af971d5aa379b49fcf498e4500db1fe59
mccluskiecameron/taylor
/faadibruno.py
3,490
4.15625
4
from math import factorial as fac def partitions(n, I=1): """The integer partitions All possible ordered lists of positive numbers summing to n. borrowed from: https://stackoverflow.com/a/44209393/4455114 """ yield (n,) for i in range(I, n//2 + 1): for p in partitions(n-i, i): ...
7fb846cef384bf05421502c4602add3a30f2c889
mahespunshi/Juniper-Fundamentals
/Comprehensions.py
1,006
4.53125
5
# List comprehension example below. notes [] parenthesis. Comprehensions can't be used for tuple. x =[x for x in range(10)] print(x) # create comprehension and it can creates for us, but in dict we need to create it first and then modify it. # so, we can't create auto-dict, we can just modify dict, unlike list. # Dict...
e423b37ef7effe8b3dc0c660079bc6db4f38c1b0
mridul567/phython-lab-
/tuple5.py
116
3.921875
4
#Adding item in tuple t=(1,2,3,'abc',5.5) print(t) n=eval(input("enter the item to be added:")) t=t+(n,) print(t)
5ba926cccaa1441f98abfe76115d3868d0494c69
mridul567/phython-lab-
/tuple6.py
114
3.859375
4
#Converting tuple to string t=(1,2,3,4) print("tuple is:",t) p=str(t) print("converted tuple:",p) print(type(p))
19e0975c0f0f0df045b2c1a1e6ff13ad97a3aee6
BaDMaN90/COM404
/Assessment_1/Q7functions.py
1,429
4.3125
4
#file function have 4 functions that will do a cool print play #this function will print piramids on the left of the face def left(emoji): print("/\/\/\\",emoji) #this function will print piramids on the right of the face def right(emoji): print(emoji,"/\/\/\\") #this function will print face between piramid...
2bbfadd71db104dbdae436ffa70a4bc717c8d435
BaDMaN90/COM404
/Basic/AE1_Review-TCA3/Q3/bot.py
246
4.03125
4
print("How many heroes must we gather?") hero_no = int(input()) print("Gathering heroes...") for gathered_hero in range(1,hero_no+1,1): print("...found hero",gathered_hero) gathered_hero += 1 print("...all the heroes have been gathered")
cfced31b3bbc3eb50ee2b0aac0dfaa66f608218a
BaDMaN90/COM404
/!My_Files/Cesear_cipher.py
3,809
3.71875
4
from random import randint import math def run_cipher(key_size): print("Alphabet:\n" + str(alphabet)) for ay in range(0, key_size, 1): shifted_alphabet.append(["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"]) letters = [] shift =...
3f7d577aacbb73da5406b3676fb12d9947c98e51
BaDMaN90/COM404
/Basic/4-repetition/1-while-loop/2-count/bot.py
684
4.125
4
#-- importing the time will allow the time delay in the code #-- progtram will print out the message and ask for input #-- 2 variables are created to run in the while loop to count down the avoided live cables and count up how many have avoided import time print("Oh no, you are tangle up in these cables :(, how many li...
21e020c0a2ec111c9a809b91ed71617595055f57
BaDMaN90/COM404
/Python/AE1_Review-TCA3/Q1/bot.py
96
3.6875
4
print("What is your name my honourable guest?") name = input() print("Mi case es su case", name)
6c30a436e58eb87b605e8f2f2f006b6f28227a0b
OhJaeSeong/PythonAlgorizmForOJS
/Recursion/RecursionStar.py
819
3.625
4
height = int(0) stars = [[]] def StarLink(sqrt , isBlank, x, y) : if isBlank : for p in range(y,y+sqrt) : for t in (x,x+sqrt) : stars[y][x] = ' ' return; if sqrt == 1 : stars[y][x] = '*' return; searchBlank = int(0) for i in range(y,y+sqrt,in...
5996714a292cf5902cefb2830c497c7d81959b54
RPadilla3/python-practice
/python-practice/py-practice/greeter.py
407
4.1875
4
prompt = "If you tell us who you are, we can personalize the messages you see." prompt += "\nWhat is your first name?" name = input(prompt) print("\n Hello, " + name + "!") number = input("Enter a number, and I'll tell you if it's even or odd: ") number = int(number) if number % 2 == 0: print("\nThe number " + ...
5d10bf344a26b484e373e93cd734b9c405d3076c
rexrony/Python-Assignment
/Assignment 4.py
2,548
4.25
4
#!/usr/bin/env python # coding: utf-8 # In[2]: #Question 1 firstname = input("Your First Name Please "); lastname = input("Your Last Name Please "); age = int(input("Your Age Please ")); city = input("Your City Please "); userdata = { 'first_name': firstname, 'last_name': lastname, 'age': age, '...
c5c2f6984a99461a38ede847fc03e6453c15a013
DaniloNovakovic/Drs_Asteroids
/core/utils/collision.py
541
3.53125
4
from entities.MovableCircle import MovableCircle from math import sqrt def is_point_inside_circle(point_x: float, point_y: float, circle: MovableCircle) -> bool: return sqrt((point_x - circle.x) ** 2 + (point_y - circle.y) ** 2) < circle.r def are_circles_collided(left_circle: MovableCircle, right_circle: Movab...
03d166637193ae6d0d3f93181d5769d23e01f48b
aidsfintech/Algorithm-and-Query
/Algorithm/python/algorithmjobs/L11/L11_04valparenthesis.py
4,507
3.640625
4
from collections import deque import sys ''' 다음에 할때는 기호에서 숫자 변환에 있어서 dict따로 선언해두면 좀더 세련될듯 ->do it now 좀더 패턴을 세부분석하면 불필요한 flag=False를 줄일수 있을듯 +중간에 2개의 연속 ()() 또는 []() 등등은 커버되지만, 3개 이상의 경우 현재 if구조로는 불가능하다는 걸 깨닫, while이 필요. ->여기서부턴 새로운 파일에 ''' def sol_doubleparenthesis(token,topval_stack): if(token==')' and topval_s...
79cea296576c6afc2df35aec5d07aaa02a980877
aidsfintech/Algorithm-and-Query
/PSrecords_python/PSskills/recursivebruteforce.py
1,142
3.6875
4
## template def judge(result,depth,inequals): window=result[depth-1]+inequals[depth]+result[depth] return eval(window) def bruteforce(result,depth,limit, inequals): if(depth>=limit): print('arrive') # print(result) else: for numchar in '123456789': result[depth]=numchar print(' '*depth...
81b7d5106a3e4814a2f50684f4057fba0b2ad021
aidsfintech/Algorithm-and-Query
/Algorithm/python/algorithmjobs/weekendtest/210410/04parenthesis.py
2,769
3.984375
4
# 괄호의 값 import sys from collections import deque precode={ '()' : '2', '[]': '3' } if __name__=="__main__": parenthesis_set=sys.stdin.readline().strip() dq_parenthesis_set=deque(parenthesis_set) stack=list() top_stack=-1 val_top='*' token_possible=True while(token_possible): ...
cb800f4deccbb80aa356af2b99bf4e7c02ca9cd3
aidsfintech/Algorithm-and-Query
/Algorithm/python/algorithmjobs/L8/L8_02recursivebinary.py
1,770
3.703125
4
def recursice_binary(depth,n,k,result): if(depth>=n): print(result) else: # for num in range(1,-1,-1): if(result.count(1)<k): result[depth]=num recursice_binary(depth+1,n,k,result) result[depth]=0 else: ...
78626d9840e94d82d23963890485fbef37791b63
aidsfintech/Algorithm-and-Query
/PSrecords_python/PSpool/skm/210501alphaYut/00alphaYut_plus.py
5,671
3.6875
4
# 알파윷 # 오전 1:12 2021-05-02 # summary # core; itertools.product and move algorithm # lesson 3 ; greedy vs bruteforce # 근사값과 정확한 답 ; 2035 vs 2050 # !!!!!!!! 하위모듈 문제랑 주어진 문제가 다르더라...!!! # 하위모듈 문제와 달리, 또한, 제외된 말에 이동 명령을 내릴 수 없다. 라는 구문이 추가됨... # lesson 4 ; 할당을 최소화해서 또 시간소요를 최소화 해보자 # 일단 딕셔너리 다 쪼개서 리스트로 만들고 import sys fro...
3dac14e5f000307c7d54a03ed9b141b11fac923b
aidsfintech/Algorithm-and-Query
/Algorithm/python/algorithmjobs/L3/L3_06eightnine.py
324
3.75
4
if __name__=='__main__': N,M = map(int,input().split()) matrix=[] for i in range(N): row=list(map(int, input().split())) matrix.append(row) #print(*matrix,sep='\n') for i in range(N): for j in range(M-1,-1,-1): print(matrix[i][j],end=' ') print...
52a92ff142d277e399339089b26d02da8f6c35da
aidsfintech/Algorithm-and-Query
/Algorithm/python/algorithmjobs/L8/L8_03division.py
2,820
3.75
4
''' 5 기준 5 4,1 3,2 3,1,1 2 2 1 2 1 1 1 1 1,1,1,1 / 1열이 첫번째 for문이고 각 시행에서 조건에 따라 앞열은 pause느낌이고 빼서 뒤로 준다 '느낌으로 이해. 이때 중복 발생 정렬과정에서 내림차순만 선택하는 방법이 있다. ''' def division(depth,mysum): global result2 if(mysum==n): print('+'.join(map(str,result2[:depth]))) else: if(depth==0): col_s...
f87caaacf6afb28f6c5ca189cf9ee4a254940030
timurchic5/learning_python
/calc.py
235
3.734375
4
print('привэд я калкулятор введи 2 числа я их сложу:') a = input('1ое число - ') b = input('2ое число - ') sum = a + b sum = str(sum) a = str(a) b = str(b) print(a + '+' + b + '=' + sum)
1c67e54b21cebdc6427ae919977b069fc030ddff
Nachimak28/DataCamptuts
/Python Data Science Toolbox (Part 1) Course/codes.py
44,603
4.84375
5
''' Write a simple function In the last video, Hugo described the basics of how to define a function. You will now write your own function! Define a function, shout(), which simply prints out a string with three exclamation marks '!!!' at the end. The code for the square() function that we wrote earlier is found...
687ff5e8da574fc4f7bc2667e9df05c72cdb1518
Nachimak28/DataCamptuts
/Python Data Science Toolbox (Part 2) Course/codes.py
48,348
4.78125
5
''' Iterating over iterables (1) Great, you're familiar with what iterables and iterators are! In this exercise, you will reinforce your knowledge about these by iterating over and printing from iterables and iterators. You are provided with a list of strings flash. You will practice iterating over the list by using ...
735d1645754831e70e04bd6d4ed1280cc63f3aa4
Nachimak28/DataCamptuts
/Network Analysis in python (part 1)/codes.py
49,256
4.40625
4
''' Basic drawing of a network using NetworkX NetworkX provides some basic drawing functionality that works for small graphs. We have selected a subset of nodes from the graph for you to practice using NetworkX's drawing facilities. It has been pre-loaded as T_sub. Instructions 100xp Import matplotlib.pyplot as p...
8536c9d42de73a7e2b426c38df271740c51f79e2
HarshHC/DataStructures
/Stack.py
1,819
4.28125
4
# Implementing stack using a linked list # Node Class class Node(object): # Initialize node with value def __init__(self, value): self.value = value self.next = None # Stack Class class Stack(object): # Initializing stack with head value and setting default size to 1 def __init__(self, ...
0ed8b87a33575bbba4838f12db14255648ad778d
gsganden/teaching_scripts
/check_completion.py
1,316
3.546875
4
ROSTER = [ ("Katharine Alderete", "Kate Alderete"), ("Prathyusha Aluri",), ("Sandeep Bansal",), ("Diana Buitrago",), ("Nishtha Chhabra", "Nish"), ("Laura Davis",), ("Corey Gibsson",), ("Teg Grover",), ("Tania Hernandez Baullosa",), ("Austin Kiyota",), ("Shobha Nikam",), (...
1abd9045507a6480eaa5a136027ec4a1b301e5bd
SugeilyCruz/edd_1310_2021
/Adts(Arrays)/nodo.py
691
3.78125
4
class Nodo: def __init__( self , dato ): self.__dato = dato self.__siguiente = None def get_dato( self ): return self.__dato def set_dato( self , d ): self.__dato = d def get_siguiente( self ): return self.__siguiente def set_siguiente( self , d ): ...
82bc520ff6d2ea345f94e190032a06296eb89b77
SugeilyCruz/edd_1310_2021
/adts/Funcion Recursiva/tarea.py
1,547
4.1875
4
print("Crear una lista de enteros en Python y realizar la suma con recursividad, el caso base es cuando la lista este vacia.") def suma_lista_rec(lista): if len(lista) == 1: return lista[0] else: return lista.pop() + suma_lista_rec(lista) def main(): datos= [4,2,3,5]#14 dt= [4,2,3,5] ...
e1b16c00e748c9414c82aea48e74ece562fead90
SugeilyCruz/edd_1310_2021
/adts/Nodo/nodo_1.py
1,131
3.71875
4
class Nodo:#Los desencapsulamos para poder borrar, cambiar etc mas facil, no sean privados. def __init__( self , dato ): self.dato = dato self.siguiente = None #ejemplo 1 a= Nodo(12) print(a.dato) #print(a.siguiente) #Empieza agregar mas elementos #Ejemplo 2 a.siguiente=Nodo(20) #Ejemplo 3 a.sigu...
f163e7eca9a1a956dc60a5b14cc292e2cc4b45a3
SugeilyCruz/edd_1310_2021
/Adts(Arrays)/circularlist.py
3,958
3.9375
4
class Nodo: def __init__(self, value, siguiente=None): self.data=value self.next=siguiente class CircularLists:#à Constructor def __init__(self): self.__head=None self.__ref=None #Self.__tail==> el mayor. self.__size=0 def get_ref(self): if self.is_empty(): ...
40d8ef7856d37e166e90cb2b9c95a3230f73b058
jlaluces123/Intro-Python
/src/days-2-4-adv/player.py
982
3.625
4
# Write a class to hold player information, e.g. what room they are in # currently. class Player: def __init__(self, name, room): self.name = name self.room = room self.inventory = [] def try_move(self, direction): key = direction + '_to' if not hasattr(self.room, key): print("No path l...
dec63d4f99825d1934be4b81836d5a3728b8038e
DKanyana/Code-Practice
/ZerosAndOnes.py
372
4.25
4
""" Given an array of one's and zero's convert the equivalent binary value to an integer. Eg: [0, 0, 0, 1] is treated as 0001 which is the binary representation of 1. """ def binary_array_to_number(arr): binNum = 0 for cnt,num in enumerate(arr): binNum += num * (2 ** (len(arr)-1-cnt)) return bin...
67588905fa64b3e7efa93541b569769688d1600f
krrish12/pythonCourse
/Day-4/DecisionMaking.py
1,578
4.125
4
var,var1 = 100,110 if ( var == 100 ) : print("Value of expression is 100 by Comparison operator") #output: Value of expression is 100 if ( var == 10 ): print("Value of expression is 10 by Comparison operator") elif(var1 == 50): print("Value of expression is 50 by Comparison operator") else:print("Value of expression i...
982cdcd7b9d77313def824ed2540e1d4f609f0ab
krrish12/pythonCourse
/Day-3/operators.py
1,463
4.21875
4
obj=10+4 print(obj)#int type #output: 14 obj=10+3.0 print(obj)#float type #output:13.0 obj=10-4 print(obj)#int type #output: 6 obj=10-3.0 print(obj)#float type #output:7.0 obj=2*2 print(obj)#int type #output: 4 obj=4.0*2 print(obj)#float type #output: 8.0 obj=2/2 print(obj)#float type #output: 1.0 obj=2%2 print(...
77a0e23b696b20b48d4ad10ac8ea4e8c74eb6d61
EliPreston/Year9DesignCS-PythonEP
/GUIcanvas.py
1,138
3.6875
4
import tkinter as tk root = tk.Tk() root.title("GUI Canvas") root.resizable(False,False) #The root.resizable(False, False) and root.max/minsize do the same thing pretty much #root.maxsize(1440,900) #root.minsize(500,500) canvas1 = tk.Canvas(root, width=720, height=720, background="black") canvas1.pack(); canvas1....
9f4d709d5fc2896939083612c57ccd8465478e26
sammitjain/GUI_python
/Tkinter5.py
486
3.921875
4
# Part 5: Binding functions to Layouts ##from tkinter import * ## ##root = Tk() ## ##def printName(): ## print("Sammit Jain") ## ##b1 = Button(root,text='Show',command=printName) #Give it the function you want to call ##b1.pack() ##root.mainloop() #Alternative method using bind from tkinter import * root = Tk() ...
2587e41149f50eb372160e6ef0a9e18d6aff2b17
jfsubrini/project5_off_converter
/p0_clean_csv.py
3,676
3.765625
4
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ Module that clean the fr.openfoodfacts.org.products.csv file from OpenFoodFacts, creating the off_myfile.csv file with 8 columns and 7289 food products (3.6 MO). """ # Import the csv module to read and write data in csv format # and the os module to delete the .csv...
5f3b803656792b211e400b86b17807f54087bcdd
Jenoe-Balote/ICS3U-Unit3-03-Python
/number_guessing_game.py
525
4.09375
4
#!/usr/bin/env python3 # Created by Jenoe Balote # Created on May 2021 # This program is the better "Number Guessing Game" import random n = random.randint(0, 9) def main(): # this function runs the better "Number Guessing Game" # input number_guessed = int(input("Enter a number between 0 - 9: ")) ...
683df892e1b3146799cf937b0ff5f59965991a06
dubeysatyam15/Google_Python_Course_Scripts
/google_c2s12.py
712
3.875
4
#!/usr/bin/env python3 import subprocess import os # To delete a file or a directory using system commands and print according to returncode book = input("Enter the file or a directory name:") decison = input("Are You Sure You Want To Delete {} ? (Y/N)".format(book)) if decison == "Y": if os.path.isdir(book): ...
56af4680b7f68a43096c0c8d8a9d81a318b3ceea
Tom0497/BCS_fuzzy
/src/FuzzyFact.py
2,097
4.46875
4
class FuzzyFact: """ A class to represent a fuzzy fact, i.e. a fact or statement with a value of certainty in the range [-1, 1], where -1 means that the fact is a 100% not true, whereas a value of 1 means that the fact is a 100% true, finally, a value of 0 means ignorance or lack of knowledge in terms o...
aa54a888d9836c542f1f94e767ef7761f82b7b87
lucasb-eyer/python-intro-lecture
/1.py
142
3.71875
4
#!/usr/bin/env python # Scoping-by-indentation i = 5 if i == 5: print("i is indeed 5") else: print("Something went horribly wrong")
26b673be35773125d61265d9060483bebbd0dc18
pururaj1908/leetcode
/ConstructBinaryTree.py
703
3.78125
4
# -*- coding: utf-8 -*- """ Created on Sat Oct 12 21:57:18 2019 @author: Puru """ class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def buildTree(self,inorder,postorder): flag = 0 root = TreeNode(postorder[...
02fe346872cecdce0c05cf1f27ac3e59b0fcef3c
pururaj1908/leetcode
/Uniqueness.py
1,375
3.671875
4
# -*- coding: utf-8 -*- """ Created on Sun Aug 25 23:43:17 2019 @author: Puru """ # hack to solve this kind of occurence problem is to make use of hash table which takes each elements' occurance class Uniqueness: def __init__(self): self.N = 0 self.elementList = [] self.counterList = dict()...
e23dbb287f1948f4e447027963c1930816b2da2c
pururaj1908/leetcode
/UniquePaths.py
518
3.65625
4
# -*- coding: utf-8 -*- """ Created on Sun Sep 1 20:45:32 2019 @author: Puru """ class UniquePath: def computeUniquePaths(self,m,n): dp = [[0 for i in range(m)] for j in range(n)] for x in range(m): dp[0][x] = 1 for x in range(n): dp[x][0] = 1 ...
f2a5173979fe4b3bcd64c89e1df2166c7a291df2
lovemasta41/My_Projects
/python/100_Skills_To_Better_Python/roll_a_dice_for_random_output.py
204
4.03125
4
import random min=1 max=6 roll_again = "yes" while roll_again == "yes" or roll_again == "y": print(random.randint(min,max)) print(random.randint(min,max)) roll_again = input("Roll again?")
8ee013d03318c1c24d9270ede65b3e78eaa70f49
lovemasta41/My_Projects
/python/100_Skills_To_Better_Python/func_generate_dict_of_square_of_keys.py
119
3.71875
4
dictt = dict() for i in range(1,21): dictt[i] = i**2 for x in dictt.values(): print(x) #print(dictt.values())
c9cd2e04f1a78e22ef8a4e525a8f1eaf00d6a6e3
lovemasta41/My_Projects
/python/100_Skills_To_Better_Python/sum_range_n_dividedby_nplus1.py
117
3.75
4
x = int(input("Enter last no.")) sum = 0.0 for i in range(1,x+1): print(i) sum += float(i/(i+1)) print(sum)
a784ad3cf29a9ec9b2e9d63e021b419a7def9f1b
lovemasta41/My_Projects
/python/tips_and_tricks/swap_variables.py
95
3.546875
4
x = 5 y = 6 x,y = y,x print(x) print(y) li = [1,2] i=0 li[i],li[i+1] = li[i+1],li[i] print(li)
704e0c10ad7f785349a4e631944cd0cfd6c0bb57
wezdenko/space-gravity-simulation
/physic_vectors.py
1,231
3.71875
4
from vector import Vector class Velocity(Vector): ''' 2D velocity vector ''' ''' speed of light m/s ''' c = 299792458 def __init__(self, x, y): for key, value in {"x": x, "y": y}.items(): if type(value) != int and type(value) != float: raise TypeError( ...
6048b803d984e8837f31aaa7c31667e396f4b0b0
yogesh1234567890/insight_python_assignment
/completed/Data3.py
384
4.21875
4
'''3. ​ Write a Python program to get a string from a given string where all occurrences of its first char have been changed to '$', except the first char itself. Sample String : 'restart' Expected Result : 'resta$t' ''' user=input("Enter a word: ") def replace_fun(val): char=val[0] val=val.replace(char,'$') ...
cf8e6c17520e8aacd721869d51f459cb4b3d7fcb
yogesh1234567890/insight_python_assignment
/completed/Data11.py
357
3.890625
4
''' 11. ​ Write a Python program to count the occurrences of each word in a given sentence. ''' sentence=str(input('Enter a sentence: ')) import collections sent=[] x=sentence.split(' ') sent +=x frequencies=collections.Counter(sent) repeated = {} for key, value in frequencies.items(): if value >=0: rep...
12d6c22a4cdacef7609f965d1f682213f06d25d1
yogesh1234567890/insight_python_assignment
/completed/Data22.py
267
4.1875
4
#22. ​ Write a Python program to remove duplicates from a list. mylist=[1,2,3,4,5,4,3,2] mylist = list(dict.fromkeys(mylist)) print(mylist) ##here the list is converted into dictionaries by which all duplicates are removed and its well again converted back to list
c0874441b6ae538e3be713d71015ec626f04272f
yogesh1234567890/insight_python_assignment
/functions/Func14.py
498
4.4375
4
#14.​ Write a Python program to sort a list of dictionaries using Lambda. models = [{'name':'yogesh', 'age':19, 'sex':'male'},{'name':'Rahsit', 'age':70, 'sex':'male'}, {'name':'Kim', 'age':29, 'sex':'female'},] print("Original list:") print(models) sorted_models = sorted(models, key = lambda x: x['name']) print("\nSo...
93705ba1b2d202737fa5f9f9852ed9814f768eb4
yogesh1234567890/insight_python_assignment
/functions/Func5.py
313
4.40625
4
""" 5.​ Write a Python function to calculate the factorial of a number (a non-negative integer). The function accepts the number as an argument. """ def fact(n): if n == 0: return 1 else: return n * fact(n-1) n=int(input("Insert a number to calculate the factiorial : ")) print(fact(n))
7d701dbeb4a04cda556c0bc2da03de589a1d26e9
yogesh1234567890/insight_python_assignment
/completed/Data39.py
206
4.1875
4
#39.​ Write a Python program to unpack a tuple in several variables. a = ("hello", 5000, "insight") #here unpacking is done (greet, number, academy) = a print(greet) print(number) print(academy)